summaryrefslogtreecommitdiff
path: root/compiler/utils
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/utils')
-rw-r--r--compiler/utils/IOEnv.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/utils/IOEnv.hs b/compiler/utils/IOEnv.hs
index 29854c51fe..17af162c9f 100644
--- a/compiler/utils/IOEnv.hs
+++ b/compiler/utils/IOEnv.hs
@@ -58,7 +58,9 @@ unIOEnv :: IOEnv env a -> (env -> IO a)
unIOEnv (IOEnv m) = m
instance Monad (IOEnv m) where
+ {-# INLINE (>>=) #-}
(>>=) = thenM
+ {-# INLINE (>>) #-}
(>>) = (*>)
fail _ = failM -- Ignore the string
@@ -70,19 +72,24 @@ instance MonadFail.MonadFail (IOEnv m) where
instance Applicative (IOEnv m) where
pure = returnM
+ {-# INLINE (<*>) #-}
IOEnv f <*> IOEnv x = IOEnv (\ env -> f env <*> x env )
(*>) = thenM_
instance Functor (IOEnv m) where
+ {-# INLINE fmap #-}
fmap f (IOEnv m) = IOEnv (\ env -> fmap f (m env))
+{-# INLINE returnM #-}
returnM :: a -> IOEnv env a
returnM a = IOEnv (\ _ -> return a)
+{-# INLINE thenM #-}
thenM :: IOEnv env a -> (a -> IOEnv env b) -> IOEnv env b
thenM (IOEnv m) f = IOEnv (\ env -> do { r <- m env ;
unIOEnv (f r) env })
+{-# INLINE thenM_ #-}
thenM_ :: IOEnv env a -> IOEnv env b -> IOEnv env b
thenM_ (IOEnv m) f = IOEnv (\ env -> do { _ <- m env ; unIOEnv f env })