diff --git a/src/Disco/Desugar.hs b/src/Disco/Desugar.hs index 7319a60c..e61be7ba 100644 --- a/src/Disco/Desugar.hs +++ b/src/Disco/Desugar.hs @@ -1,3 +1,7 @@ +{-# OPTIONS_GHC -fno-warn-unrecognised-pragmas #-} + +{-# HLINT ignore "Functor law" #-} + -- | -- Module : Disco.Desugar -- Copyright : disco team and contributors @@ -238,7 +242,7 @@ desugarAbs quant overallTy body = do -- Wrap a term in a test frame to report the values of all variables -- bound in the patterns. addDbgInfo :: [APattern] -> ATerm -> ATerm - addDbgInfo ps t = ATTest (map withName $ concatMap varsBound ps) t + addDbgInfo ps = ATTest (map withName $ concatMap varsBound ps) where withName (n, ty) = (name2String n, ty, n) diff --git a/src/Disco/Eval.hs b/src/Disco/Eval.hs index b5ddd356..6e2a490e 100644 --- a/src/Disco/Eval.hs +++ b/src/Disco/Eval.hs @@ -100,7 +100,7 @@ import Disco.Value -- Configuation options ------------------------------------------------------------ -data DiscoConfig = DiscoConfig +newtype DiscoConfig = DiscoConfig { _debugMode :: Bool } @@ -185,7 +185,7 @@ inputSettings = -- | Run a top-level computation. runDisco :: DiscoConfig -> (forall r. Members DiscoEffects r => Sem r ()) -> IO () -runDisco cfg m = +runDisco cfg = void . H.runInputT inputSettings . runFinal @(H.InputT IO) @@ -201,7 +201,6 @@ runDisco cfg m = . mapError EvalErr -- Embed runtime errors into top-level error type . failToError Panic -- Turn pattern-match failures into a Panic error . runReader emptyCtx -- Keep track of current Env - $ m where msgFilter | cfg ^. debugMode = const True diff --git a/src/Disco/Messages.hs b/src/Disco/Messages.hs index afacd7d1..0e5eab99 100644 --- a/src/Disco/Messages.hs +++ b/src/Disco/Messages.hs @@ -1,10 +1,6 @@ {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE TemplateHaskell #-} ------------------------------------------------------------------------------ - ------------------------------------------------------------------------------ - -- | -- Module : Disco.Messages -- Copyright : disco team and contributors @@ -30,7 +26,7 @@ data MessageType | Debug deriving (Show, Read, Eq, Ord, Enum, Bounded) -data Message ann = Message {_messageType :: MessageType, _message :: (Doc ann)} +data Message ann = Message {_messageType :: MessageType, _message :: Doc ann} deriving (Show) makeLenses ''Message diff --git a/src/Disco/Parser.hs b/src/Disco/Parser.hs index 74f07149..fff2abca 100644 --- a/src/Disco/Parser.hs +++ b/src/Disco/Parser.hs @@ -1,4 +1,6 @@ {-# LANGUAGE TemplateHaskell #-} +{-# OPTIONS_GHC -fno-warn-unrecognised-pragmas #-} +{-# HLINT ignore "Functor law" #-} -- | -- Module : Disco.Parser @@ -346,7 +348,7 @@ decimal = -- either some digits optionally followed by bracketed digits... (,) <$> some digit <*> optional (brackets (some digit)) -- ...or just bracketed digits. - <|> ([],) <$> (Just <$> brackets (some digit)) + <|> (([],) . Just <$> brackets (some digit)) readDecimal a (b, mrep) = read a % 1 -- integer part diff --git a/src/Disco/Subst.hs b/src/Disco/Subst.hs index 5d11c02a..c8905ac8 100644 --- a/src/Disco/Subst.hs +++ b/src/Disco/Subst.hs @@ -1,9 +1,5 @@ {-# LANGUAGE OverloadedStrings #-} ------------------------------------------------------------------------------ - ------------------------------------------------------------------------------ - -- SPDX-License-Identifier: BSD-3-Clause -- | @@ -98,7 +94,7 @@ x |-> t = Substitution (M.singleton x t) -- As one would expect, composition is associative and has 'idS' as -- its identity. (@@) :: Subst a a => Substitution a -> Substitution a -> Substitution a -(Substitution s1) @@ (Substitution s2) = Substitution ((M.map (applySubst (Substitution s1))) s2 `M.union` s1) +(Substitution s1) @@ (Substitution s2) = Substitution $ M.map (applySubst (Substitution s1)) s2 `M.union` s1 -- | Compose a whole container of substitutions. For example, -- @compose [s1, s2, s3] = s1 \@\@ s2 \@\@ s3@. diff --git a/src/Disco/Typecheck.hs b/src/Disco/Typecheck.hs index 0ed3df14..ffae5824 100644 --- a/src/Disco/Typecheck.hs +++ b/src/Disco/Typecheck.hs @@ -468,7 +468,7 @@ inferTop t = do cvs = containerVars (getType at') -- Replace them all with List. - at'' = applySubst (Subst.fromList $ zip (S.toList cvs) (repeat (TyAtom (ABase CtrList)))) at' + at'' = applySubst (Subst.fromList $ map (, TyAtom (ABase CtrList)) (S.toList cvs)) at' -- Finally, quantify over any remaining type variables and return -- the term along with the resulting polymorphic type. @@ -981,7 +981,7 @@ typecheck (Check checkTy) tm@(TAbs Lam body) = do -- Then check the type of the body under a context extended with -- types for all the arguments. extends ctx $ - ATAbs Lam checkTy <$> (bind (coerce typedArgs) <$> check t resTy) + ATAbs Lam checkTy . bind (coerce typedArgs) <$> check t resTy where -- Given the patterns and their optional type annotations in the -- head of a lambda (e.g. @x (y:Z) (f : N -> N) -> ...@), and the