From b20cf4ecbf244f091f4084c11ae2350d248ce6ef Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Wed, 11 Sep 2013 18:46:54 -0500 Subject: Fix AMP warnings. Authored-by: David Luposchainsky Signed-off-by: Austin Seipp --- compiler/stgSyn/CoreToStg.lhs | 9 +++++++++ compiler/stgSyn/StgLint.lhs | 8 ++++++++ 2 files changed, 17 insertions(+) (limited to 'compiler/stgSyn') 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 -- cgit v1.2.1