On Nov 5, 2007 2:41 PM, Graham Fawcett <graham.fawcett@gmail.com> wrote:
On Nov 5, 2007 1:46 PM, Maurí­cio <briqueabraque@yahoo.com> wrote:
> Hi,
>
> Is there a way to run 'ghc -e' taking input
> from standard input? I would like to use it
> in a pipe.

It seems to me that you can use getContents, et. al., as you would
from any other Haskell program:

$ echo hello there mauricio | ghc -e "print =<< ( Control.Monad.liftM
(reverse . words)) getContents"
["mauricio","there","hello"]

hm, which raises the question of exactly what Maurí­cio meant.  Maurí­cio, if you mean you want to do ghc -e "some code which gets its data from standard input", then Graham's solution is exactly what you want.  If you mean you want to have ghc -e run some code which itself comes from standard input, then you want xargs (just do a man xargs to see how to use it).  In retrospect I'm guessing that Graham answered your real question...? =)

-Brent