capslocker.hs has following code:
import Control.Monad
import Data.Char
main = forever $ do
putStr "Give me some input: "
l <- getLine
putStrLn $ map toUpper l
haiku.txt has following contents:
I'm a lil' teapot
What's with that airplane food, huh?
It's so small, tasteless
In the terminal, I am able to do:
optimight@optimight:~$ cat haiku.txt
I'm a lil' teapot
What's with that airplane food, huh?
It's so small, tasteless
And this:
optimight@optimight:~$ cat haiku.txt | ./capslocker
Give me some input: I'M A LIL' TEAPOT
Give me some input: WHAT'S WITH THAT AIRPLANE FOOD, HUH?
Give me some input: IT'S SO SMALL, TASTELESS
Give me some input: capslocker: <stdin>: hGetLine: end of file
How to test the same (as done in terminal) in emacs23 - haskell mode? Please guide.
Please note that, in emacs - haskell mode, I have tried following:
GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :load "/home/optimight/capslocker.hs"
[1 of 1] Compiling Main ( /home/optimight/capslocker.hs, interpreted )
Ok, modules loaded: Main.
*Main> cat haiku.txt | ./capslocker
<interactive>:3:15: parse error on input `|'
*Main>
From the ghci prompt, you can call shell commands by prefixing with
:!
.It ought to work the same in emacs.