diff options
| author | hallgren <hallgren@chalmers.se> | 2013-11-21 15:01:04 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2013-11-21 15:01:04 +0000 |
| commit | fe065b5ee417f1f155edeeeafdf6f3d2c21da130 (patch) | |
| tree | 1ea95887392c84040b4bd4b0d9a81418d48dfe38 /src/compiler/GF/Compile/ReadFiles.hs | |
| parent | aad6a1c4bb78430c90173a719f0c7a27cc5675d5 (diff) | |
Some more monadic lifting changes
Diffstat (limited to 'src/compiler/GF/Compile/ReadFiles.hs')
| -rw-r--r-- | src/compiler/GF/Compile/ReadFiles.hs | 6 |
1 files changed, 3 insertions, 3 deletions
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 |
