Skip to content

Commit

Permalink
apply hlint hints
Browse files Browse the repository at this point in the history
  • Loading branch information
byorgey committed May 22, 2024
1 parent e6cdffc commit a18ee7b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 17 deletions.
6 changes: 5 additions & 1 deletion src/Disco/Desugar.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{-# OPTIONS_GHC -fno-warn-unrecognised-pragmas #-}

{-# HLINT ignore "Functor law" #-}

-- |
-- Module : Disco.Desugar
-- Copyright : disco team and contributors
Expand Down Expand Up @@ -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)

Expand Down
5 changes: 2 additions & 3 deletions src/Disco/Eval.hs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ import Disco.Value
-- Configuation options
------------------------------------------------------------

data DiscoConfig = DiscoConfig
newtype DiscoConfig = DiscoConfig
{ _debugMode :: Bool
}

Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
6 changes: 1 addition & 5 deletions src/Disco/Messages.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE TemplateHaskell #-}

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------

-- |
-- Module : Disco.Messages
-- Copyright : disco team and contributors
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/Disco/Parser.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-warn-unrecognised-pragmas #-}
{-# HLINT ignore "Functor law" #-}

-- |
-- Module : Disco.Parser
Expand Down Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions src/Disco/Subst.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}

-----------------------------------------------------------------------------

-----------------------------------------------------------------------------

-- SPDX-License-Identifier: BSD-3-Clause

-- |
Expand Down Expand Up @@ -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@.
Expand Down
4 changes: 2 additions & 2 deletions src/Disco/Typecheck.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a18ee7b

Please sign in to comment.