<br><br><div class="gmail_quote">On Nov 5, 2007 2:41 PM, Graham Fawcett <<a href="mailto:graham.fawcett@gmail.com">graham.fawcett@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Nov 5, 2007 1:46 PM, Maurício <<a href="mailto:briqueabraque@yahoo.com">briqueabraque@yahoo.com</a>> wrote:<br>> Hi,<br>><br>> Is there a way to run 'ghc -e' taking input<br>
> from standard input? I would like to use it<br>> in a pipe.<br><br></div>It seems to me that you can use getContents, et. al., as you would<br>from any other Haskell program:<br><br>$ echo hello there mauricio | ghc -e "print =<< (
Control.Monad.liftM<br>(reverse . words)) getContents"<br>["mauricio","there","hello"]<br></blockquote><br>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...? =)
<br><br>-Brent</div>