From fe065b5ee417f1f155edeeeafdf6f3d2c21da130 Mon Sep 17 00:00:00 2001 From: hallgren Date: Thu, 21 Nov 2013 15:01:04 +0000 Subject: Some more monadic lifting changes --- src/compiler/GF/Compile/ReadFiles.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/compiler/GF/Compile/ReadFiles.hs') diff --git a/src/compiler/GF/Compile/ReadFiles.hs b/src/compiler/GF/Compile/ReadFiles.hs index 54abc7f48..5e65dcba6 100644 --- a/src/compiler/GF/Compile/ReadFiles.hs +++ b/src/compiler/GF/Compile/ReadFiles.hs @@ -212,11 +212,11 @@ importsOfModule (m,mi) = (modName m,depModInfo mi []) -- | options can be passed to the compiler by comments in @--#@, in the main file getOptionsFromFile :: (MonadIO m,ErrorMonad m) => FilePath -> m Options getOptionsFromFile file = do - s <- handle (liftIO $ BS.readFile file) - (\_ -> raise $ "File " ++ file ++ " does not exist") + s <- either (\_ -> raise $ "File " ++ file ++ " does not exist") return =<< + liftIO (try $ BS.readFile file) let ls = filter (BS.isPrefixOf (BS.pack "--#")) $ BS.lines s fs = map (BS.unpack . BS.unwords . BS.words . BS.drop 3) ls - liftErr $ parseModuleOptions fs + parseModuleOptions fs getFilePath :: MonadIO m => [FilePath] -> String -> m (Maybe FilePath) getFilePath paths file = liftIO $ get paths -- cgit v1.2.3