There’s a really convenient way to write quick scripts in haskell on Nix systems, even including haskell packages:
#!/usr/bin/env nix-shell
#!nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (pkgs: [ ...all of the packages I want... ])"
main = do
# do stuff
putStrLn "Hello world from a Haskell script!"
This is nice because it runs on any Nix system, whether or not they have a haskell installation. But when I try the same for OCaml I get an error:
#!/usr/bin/env nix-shell
#!nix-shell --pure -i ocaml -p ocaml
print_string "Hello world!\n";;
❯ ./testing123.ml
File "./nixos-up.ml", line 2, characters 0-2:
2 | #!nix-shell --pure -i ocaml -p ocaml
^^
Error: Syntax error
Is there any way to get the ocaml
interpreter to ignore the shebang lines? It already seems like one of them is being ignore but the second one is causing problems.