GF.Compile.ReadFiles: reduced code duplication

This commit is contained in:
hallgren
2013-12-16 14:04:57 +00:00
parent 1010d357c5
commit 2b16962835
2 changed files with 11 additions and 9 deletions

View File

@@ -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