Cannot pass curry system options
The usage message says that I can use runcurry
as follows.
As a shell command:
> runcurry [Curry system options] <Curry program name> <run-time arguments>
However, I could not figure out how to set a path
as option. So I checked out the code and realised that the executable cannot handle passed options.
main :: IO ()
main = do
args <- getArgs
case args of
("-h":_) -> putStrLn usageMsg
("--help":_) -> putStrLn usageMsg
("-?":_) -> putStrLn usageMsg
_ -> checkFirstArg [] args
checkFirstArg curryargs (arg1:args) =
if fileSuffix arg1 `elem` ["curry","lcurry"]
then execCurryProgram arg1 curryargs args >>= exitWith
else do
isexec <- isExecutable arg1
if isexec
then do
-- argument is not a Curry file but it is an executable, hence, a script:
-- store it in a Curry program, where lines starting with '#' are removed
progname <- getNewProgramName
proginput <- readFile arg1
let (proglines, hashlines) = partition noHashLine (lines proginput)
progtext = unlines proglines
if any isHashJITOption hashlines
then execOrJIT arg1 progname progtext curryargs args >>= exitWith
else do
writeFile progname progtext
execAndDeleteCurryProgram progname curryargs args >>= exitWith
else checkFirstArg (curryargs++[arg1]) args
So arg1
is only a valid argument if it is a file name or a script. In the end, I get a rather weird runtime error, because the passed arguments are interpreted as a script.
m-067:Curry sad$ ~/Documents/Programming/kics2/currytools/runcurry/RunCurry :path pflp/src Strings.curry
RunCurry: pflp/src: openFile: inappropriate type (is a directory)