diff options
Diffstat (limited to 'compiler/rename/RnPat.lhs')
-rw-r--r-- | compiler/rename/RnPat.lhs | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/compiler/rename/RnPat.lhs b/compiler/rename/RnPat.lhs index e7cecf8f3f..9488f91ddd 100644 --- a/compiler/rename/RnPat.lhs +++ b/compiler/rename/RnPat.lhs @@ -44,7 +44,7 @@ import {-# SOURCE #-} TcSplice ( runQuasiQuotePat ) import HsSyn import TcRnMonad -import TcHsSyn ( hsOverLitName ) +import TcHsSyn ( hsOverLitName ) import RnEnv import RnTypes import DynFlags @@ -54,14 +54,14 @@ import NameSet import RdrName import BasicTypes import Util -import ListSetOps ( removeDups ) +import ListSetOps ( removeDups ) import Outputable import SrcLoc import FastString -import Literal ( inCharRange ) -import TysWiredIn ( nilDataCon ) -import DataCon ( dataConName ) -import Control.Monad ( when ) +import Literal ( inCharRange ) +import TysWiredIn ( nilDataCon ) +import DataCon ( dataConName ) +import Control.Monad ( when, liftM, ap ) import Data.Ratio \end{code} @@ -98,6 +98,13 @@ newtype CpsRn b = CpsRn { unCpsRn :: forall r. (b -> RnM (r, FreeVars)) -> RnM (r, FreeVars) } -- See Note [CpsRn monad] +instance Functor CpsRn where + fmap = liftM + +instance Applicative CpsRn where + pure = return + (<*>) = ap + instance Monad CpsRn where return x = CpsRn (\k -> k x) (CpsRn m) >>= mk = CpsRn (\k -> m (\v -> unCpsRn (mk v) k)) |