
14 Feb
2011
14 Feb
'11
1:49 p.m.
Thomas Davie schrieb:
A while ago I remember someone showing me some tool, I *think* ghci that allowed you to pass it a function of type String -> String as an input, and have it simply run that function on stdin (presumably using interact) to achieve useful things like this...
$ cat myFile.txt | ghci -e 'unlines . zipWith (\x y -> show x ++ " " ++ y) [1..] . lines'
Does anyone know what it was that I saw being used here?
It must be just 'ghc' not 'ghci' and yes, 'interact' must be called.