ipso
ipso copied to clipboard
`--script` flag
Depends on #74.
When --script is set, the entire file is treated as a comp expression defining the IO action to run.
e.g.
#! /usr/bin/env -S ipso --script
println "hello, world!"
is equivalent to
#! /usr/bin/env ipso
main : IO ()
main =
comp
println "hello, world!"
This file has a different syntax to non-script files. Something like:
script_file ::=
script_line+
script_line ::=
import
from_import
comp_expr_line
Make sure there are datatypes that reflect this.
I don't like that users of env would have to add the -S option to use this feature.
Maybe a busybox-style approach would be useful. When ipso looks at argv[0] and sees that it's called as ipso-script, it behaves as if the --script option were set.
#! /usr/bin/env ipso-script
println "hello, world!"
This introduces a new problem: making sure the user has an ipso-script symlink on their system.