diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2019-06-08 20:48:07 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-06-12 07:37:12 -0400 |
commit | 1219f8e8a3d1b58263bea76822322b746a632778 (patch) | |
tree | bd93bdf1e09cd26a7c6104ba37c6734a74e8a7bc /compiler/stgSyn | |
parent | 217e6db4af6752b13c586d4e8925a4a9a2f47245 (diff) | |
download | haskell-1219f8e8a3d1b58263bea76822322b746a632778.tar.gz |
Use DeriveFunctor throughout the codebase (#15654)
Diffstat (limited to 'compiler/stgSyn')
-rw-r--r-- | compiler/stgSyn/CoreToStg.hs | 8 | ||||
-rw-r--r-- | compiler/stgSyn/StgLint.hs | 7 |
2 files changed, 6 insertions, 9 deletions
diff --git a/compiler/stgSyn/CoreToStg.hs b/compiler/stgSyn/CoreToStg.hs index 12766e90d4..3187298425 100644 --- a/compiler/stgSyn/CoreToStg.hs +++ b/compiler/stgSyn/CoreToStg.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP #-} +{-# LANGUAGE CPP, DeriveFunctor #-} -- -- (c) The GRASP/AQUA Project, Glasgow University, 1993-1998 @@ -50,7 +50,7 @@ import SrcLoc ( mkGeneralSrcSpan ) import Data.List.NonEmpty (nonEmpty, toList) import Data.Maybe (fromMaybe) -import Control.Monad (liftM, ap) +import Control.Monad (ap) -- Note [Live vs free] -- ~~~~~~~~~~~~~~~~~~~ @@ -813,6 +813,7 @@ newtype CtsM a = CtsM { unCtsM :: IdEnv HowBound -> a } + deriving (Functor) data HowBound = ImportBound -- Used only as a response to lookupBinding; never @@ -861,9 +862,6 @@ thenCts :: CtsM a -> (a -> CtsM b) -> CtsM b thenCts m k = CtsM $ \env -> unCtsM (k (unCtsM m env)) env -instance Functor CtsM where - fmap = liftM - instance Applicative CtsM where pure = returnCts (<*>) = ap diff --git a/compiler/stgSyn/StgLint.hs b/compiler/stgSyn/StgLint.hs index c949f348f1..f83b44859c 100644 --- a/compiler/stgSyn/StgLint.hs +++ b/compiler/stgSyn/StgLint.hs @@ -32,7 +32,8 @@ Since then there were some attempts at enabling it again, as summarised in basic properties listed above. -} -{-# LANGUAGE ScopedTypeVariables, FlexibleContexts, TypeFamilies #-} +{-# LANGUAGE ScopedTypeVariables, FlexibleContexts, TypeFamilies, + DeriveFunctor #-} module StgLint ( lintStgTopBindings ) where @@ -258,6 +259,7 @@ newtype LintM a = LintM -> Bag MsgDoc -- Error messages so far -> (a, Bag MsgDoc) -- Result and error messages (if any) } + deriving (Functor) data LintFlags = LintFlags { lf_unarised :: !Bool -- ^ have we run the unariser yet? @@ -293,9 +295,6 @@ initL this_mod unarised locals (LintM m) = do else Just (vcat (punctuate blankLine (bagToList errs))) -instance Functor LintM where - fmap = liftM - instance Applicative LintM where pure a = LintM $ \_mod _lf _loc _scope errs -> (a, errs) (<*>) = ap |