How to run a Haskell file in interpreted mode

前端 未结 4 1498
隐瞒了意图╮
隐瞒了意图╮ 2020-12-04 14:23

I\'ve been told you can interpret Haskell files (which I assume means they will work like Ruby/Python/Perl). I can\'t find the command line option on GHC to do this, though.

4条回答
  •  旧巷少年郎
    2020-12-04 14:54

    You can have a script like this:

    #!/usr/bin/env runhaskell
    main = putStrLn "hello world"
    

    After making the file executable (ie chmod +x haskell_script), you can run it like any other shell script.

提交回复
热议问题