Bartek Banachewicz
Bartek Banachewicz

Reputation: 39380

How to run haskell code that's passed via command argument to the interpreter?

Among other methods, there are a few most common ways to run a haskell program:

I weren't able to find, however, how to run simple code from standard input / command arguments.

For example, standard Lua interpreter will allow you to do:

$ lua -e "print (2+2)"
4

What would be an equivalent of the above for a common Haskell Platform environment?

Upvotes: 3

Views: 524

Answers (1)

kqr
kqr

Reputation: 15028

It's just the same.

$ ghc -e "print (2+2)"
4

Upvotes: 6

Related Questions