Note the hk script gives you a richer default environment, including System.Environment and a bunch of other commonly used modules.

Also, some magic to sort of detect what you want, in the case of whether you give it a pure function vs an IO etc. For one offs on the command line, a slightly less picky type check seems to make sense in my opinion. In the case that it doesn't work, it lets you edit the script in a text editor, there by showing you what the real haskell looks like.

Not that I am especially proud, the implementation could be cleaned up a lot I am sure, but the user interface is failry nice I think.

One caveat I probably should mention in the README but didn't, is that your script is copied to a file stored under /tmp, so you don't want to put passwords or anything of that matter in it.



On Thu, Feb 5, 2015 at 6:46 PM, Tom Ellis <tom-lists-haskell-cafe-2013@jaguarpaw.co.uk> wrote:
On Fri, Feb 06, 2015 at 12:42:14AM +0100, Peter Simons wrote:
> This announcement left me totally amazed at the realization that neither
> "runhaskell" nor "ghci" seem to have a command-line option equivalent to
> "-c" in Bourne shell.
>
> Am I missing something terribly obvious?

How about

  ghc -e 'do { putStrLn "What is your name?"; name <- getLine; putStrLn $ "Hello " ++ name }'
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe