summaryrefslogtreecommitdiff
path: root/src/compiler/GF
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2012-02-20 17:26:49 +0000
committerhallgren <hallgren@chalmers.se>2012-02-20 17:26:49 +0000
commit94685d184d2608ca1c0847779fdfc18e23fe760d (patch)
tree93a7373333ea5540fd3aa13afbb0a23ea4d33bce /src/compiler/GF
parente25ee8e2fb00e3994a12bf6c01cc74fd89279292 (diff)
GF.Inra.UseIO: add instance Functor IOE, add method fail to instance Monad IOE
Diffstat (limited to 'src/compiler/GF')
-rw-r--r--src/compiler/GF/Infra/UseIO.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/compiler/GF/Infra/UseIO.hs b/src/compiler/GF/Infra/UseIO.hs
index 309b09e46..cd9fe8a95 100644
--- a/src/compiler/GF/Infra/UseIO.hs
+++ b/src/compiler/GF/Infra/UseIO.hs
@@ -137,11 +137,14 @@ ioeIO io = ioe (io >>= return . return)
ioeErr :: Err a -> IOE a
ioeErr = ioe . return
+instance Functor IOE where fmap = liftM
+
instance Monad IOE where
return a = ioe (return (return a))
IOE c >>= f = IOE $ do
x <- c -- Err a
appIOE $ err ioeBad f x -- f :: a -> IOE a
+ fail = ioeBad
ioeBad :: String -> IOE a
ioeBad = ioe . return . Bad