summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Infra/UseIO.hs
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2013-12-16 14:04:57 +0000
committerhallgren <hallgren@chalmers.se>2013-12-16 14:04:57 +0000
commit2b16962835af120a332c5e54c3465a0d02e9b668 (patch)
treedce62262dd77ceaa1ee5b3f71130eeca5eab7449 /src/compiler/GF/Infra/UseIO.hs
parent1010d357c53e45902e8ee7a53b39464bb9b8ab06 (diff)
GF.Compile.ReadFiles: reduced code duplication
Diffstat (limited to 'src/compiler/GF/Infra/UseIO.hs')
-rw-r--r--src/compiler/GF/Infra/UseIO.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/compiler/GF/Infra/UseIO.hs b/src/compiler/GF/Infra/UseIO.hs
index 0af26efa7..de3182f0e 100644
--- a/src/compiler/GF/Infra/UseIO.hs
+++ b/src/compiler/GF/Infra/UseIO.hs
@@ -139,6 +139,8 @@ instance Monad IOE where
appIOE $ err raise f x -- f :: a -> IOE a
fail = raise
+maybeIO io = either (const Nothing) Just `fmap` liftIO (try io)
+
useIOE :: a -> IOE a -> IO a
useIOE a ioe = appIOE ioe >>= err (\s -> putStrLn s >> return a) return