From 2b16962835af120a332c5e54c3465a0d02e9b668 Mon Sep 17 00:00:00 2001 From: hallgren Date: Mon, 16 Dec 2013 14:04:57 +0000 Subject: GF.Compile.ReadFiles: reduced code duplication --- src/compiler/GF/Infra/UseIO.hs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/compiler/GF/Infra/UseIO.hs') 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 -- cgit v1.2.3