bash - Haskell Noob In Need of Assistance -
this bit long, bear me!
i'm having bit of trouble working haskell program, have use part of uni project. reference, it's casper.
so, you're supposed execute script, bash script invoke hugs interpreter this:
exec $hugsbin/hugs $hugsargs +p"casper> " $files
where $files points main.lhs file.
after this, need invoke function "compile" path file, in interpreter.
i need perform above in scripted manner. need automated because i'm writing program call on casper in background.
so compiled .lhs file. want execute "compile" function have no idea how done. try:
./main compile <a path>
from command line returns me error file "test" not found. upon investigation, see these lines in main.lhs file:
>main :: string -> io() >main = compile "test" >compile :: string -> io() >compile s = catch (compile0 false s) handler [...snipped]
the 2nd line solves question. question is, how invoke "compile" function , pass path after have compiled main.lhs? interpreter, type "compile " , works, can't same work after compiling main.lhs , executing command line? ideas why? there way can script hugs if else fails?
thank assistance!
you may access command-line arguments passed haskell program via getargs
. example, sounds want main function this:
>main = > args <- getargs > case args of > [] -> putstrln "what file did want me compile?" > [filename] -> compile filename > _ -> putstrln "i compile 1 file @ time."
modify taste.
Comments
Post a Comment