mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-10-25 09:13:18 -06:00
eliminate partial functions
This commit is contained in:
1 parent
7513dca294
commit
dc2b87315e
2 files changed
+5
-5
No files matched your search
@@ -35,8 +35,8 @@ loadLangs = loadLangsFrom configFile
|
||||
-- | Load language information from specified config file
|
||||
loadLangsFrom:: FilePath -> IO [LangInfo]
|
||||
loadLangsFrom configFile = do
|
||||
lns <- readFile configFile >>= return . lines
|
||||
mapM mkLangInfo (tail lns)
|
||||
_:lns <- readFile configFile >>= return . lines
|
||||
mapM mkLangInfo lns
|
||||
where
|
||||
maybeBit bits n = if length bits >= (n+1) && length (bits !! n) > 0 then Just (bits !! n) else Nothing
|
||||
boolBit bits n def = if length bits >= (n+1) && length (bits !! n) > 0 then (if def then bits !! n /= "n" else bits !! n == "y") else def
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
-- | Main build script for RGL
|
||||
|
||||
import Data.List (find,isPrefixOf,isSuffixOf,(\\))
|
||||
import Data.Maybe (catMaybes)
|
||||
import Data.Maybe (catMaybes,listToMaybe)
|
||||
import System.IO (hPutStrLn,stderr)
|
||||
import System.IO.Error (catchIOError)
|
||||
import System.Exit (ExitCode(..),exitFailure)
|
||||
@@ -119,7 +119,7 @@ mkInfo = do
|
||||
let gf = maybe default_gf id (getFlag gf_flag args)
|
||||
-- Look for install location in a few different places
|
||||
let mflag = getFlag destination_flag args
|
||||
menvar <- lookupEnv "GF_LIB_PATH" >>= return . fmap (head . splitSearchPath)
|
||||
menvar <- lookupEnv "GF_LIB_PATH" >>= return . ((=<<) (listToMaybe . splitSearchPath))
|
||||
mbuilt <- catchIOError (readProcess gf ["--version"] "" >>= return . getPath) (\e -> return Nothing)
|
||||
let
|
||||
inst_dir =
|
||||
@@ -293,7 +293,7 @@ checkArgs args = do
|
||||
getCommands :: [String] -> [RGLCommand]
|
||||
getCommands args =
|
||||
let
|
||||
cmdModules = head $ filter (\cmd -> cmdName cmd == "modules") rglCommands
|
||||
cmdModules:_ = filter (\cmd -> cmdName cmd == "modules") rglCommands
|
||||
cmds0 =
|
||||
[ cmd
|
||||
| arg <- args
|
||||
|
||||
Reference in new issue
Block a user