definition:
|
replOptions :: ReplState
-> [(String, ReplState -> String -> IO (Maybe ReplState))]
replOptions rst =
[ ("v0" , \r _ -> return (Just r { verbose = 0 }))
, ("v1" , \r _ -> return (Just r { verbose = 1 }))
, ("v2" , \r _ -> return (Just r { verbose = 2 }))
, ("v3" , \r _ -> return (Just r { verbose = 3 }))
, ("v4" , \r _ -> return (Just r { verbose = 4 }))
, ("path" , setOptionPath )
, ("prompt" , setPrompt )
, ("safe" , \r _ -> return (Just r { safeExec = True }))
, ("parser" , \r a -> return (Just r { parseOpts = a }))
, ("timeout" , setTimeout )
, ("args" , \r a -> return (Just r { rtsArgs = a }))
-- , ("prelude" , \r a -> return (Just r { preludeName = a }))
, ("+bindings" , \r _ -> return (Just r { showBindings = True }))
, ("-bindings" , \r _ -> return (Just r { showBindings = False }))
, ("+echo" , \r _ -> return (Just r { withEcho = True }))
, ("-echo" , \r _ -> return (Just r { withEcho = False }))
, ("+show" , \r _ -> return (Just r { withShow = True }))
, ("-show" , \r _ -> return (Just r { withShow = False }))
, ("+time" , \r _ -> return (Just r { showTime = True }))
, ("-time" , \r _ -> return (Just r { showTime = False }))
] ++
concatMap setCmpOpt ccopts
where
ccopts = ccOpts (compiler rst)
setCmpOpt (CCOption _ _ tags) = map setOptTag tags
setOptTag opt@(ConstOpt tag _) =
(tag,
\r _ -> return (Just r { cmpOpts = map (replaceCompilerOption ccopts opt)
(cmpOpts r) }))
setOptTag (ArgOpt tag _ fo) = (tag, checkArg)
where
checkArg r a =
maybe (skipCommand "Illegal option argument!")
(\_ -> return (Just r { cmpOpts = map (replaceCompilerOption ccopts
(ArgOpt tag a fo))
(cmpOpts r) }))
(fo a)
|