In the shell you can string commands together, separated by a semicolon:
cd ../haskell; rm ./foo; ghc foo.hs; cd ../original_directory
It would be great if you could do a similar thing for command-line arguments for ghci, e.g.
ghci Foo.hs; a <- getFoo; print a
Is this possible?
You can use ghc -e
for this:
sorghum:~/programming% cat test.hs
getFoo = getLine
sorghum:~/programming% ghc test.hs -e 'do { a <- getFoo; print a }'
oenuth
"oenuth"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With