summaryrefslogtreecommitdiff
path: root/compiler/stgSyn
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/stgSyn')
-rw-r--r--compiler/stgSyn/CoreToStg.lhs9
-rw-r--r--compiler/stgSyn/StgLint.lhs8
2 files changed, 17 insertions, 0 deletions
diff --git a/compiler/stgSyn/CoreToStg.lhs b/compiler/stgSyn/CoreToStg.lhs
index c87de4e65f..80b81a68e4 100644
--- a/compiler/stgSyn/CoreToStg.lhs
+++ b/compiler/stgSyn/CoreToStg.lhs
@@ -44,6 +44,8 @@ import ForeignCall
import Demand ( isSingleUsed )
import PrimOp ( PrimCall(..) )
+import Control.Monad (liftM, ap)
+
-- Note [Live vs free]
-- ~~~~~~~~~~~~~~~~~~~
--
@@ -982,6 +984,13 @@ thenLne :: LneM a -> (a -> LneM b) -> LneM b
thenLne m k = LneM $ \env lvs_cont
-> unLneM (k (unLneM m env lvs_cont)) env lvs_cont
+instance Functor LneM where
+ fmap = liftM
+
+instance Applicative LneM where
+ pure = return
+ (<*>) = ap
+
instance Monad LneM where
return = returnLne
(>>=) = thenLne
diff --git a/compiler/stgSyn/StgLint.lhs b/compiler/stgSyn/StgLint.lhs
index 3509a83849..04349db3df 100644
--- a/compiler/stgSyn/StgLint.lhs
+++ b/compiler/stgSyn/StgLint.lhs
@@ -25,6 +25,7 @@ import Util
import SrcLoc
import Outputable
import FastString
+import Control.Applicative ( Applicative(..) )
import Control.Monad
import Data.Function
@@ -319,6 +320,13 @@ initL (LintM m)
Just (vcat (punctuate blankLine (bagToList errs)))
}
+instance Functor LintM where
+ fmap = liftM
+
+instance Applicative LintM where
+ pure = return
+ (<*>) = ap
+
instance Monad LintM where
return a = LintM $ \_loc _scope errs -> (a, errs)
(>>=) = thenL