ipso icon indicating copy to clipboard operation
ipso copied to clipboard

`--script` flag

Open LightAndLight opened this issue 3 years ago • 2 comments

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!"

LightAndLight avatar Mar 18 '22 07:03 LightAndLight

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.

LightAndLight avatar May 13 '22 23:05 LightAndLight

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.

LightAndLight avatar Aug 04 '22 22:08 LightAndLight