On Thu, 21 Sep 2006, Bruno Martínez wrote: > > getList :: IO [Char] > > getList = take5 `fmap` getContents -- a thin IO "skin" > > > > take5 :: [Char] -> [Char] > > take5 = take 5 . filter (`elem` ['a'..'e']) -- the actual worker > > The problem is that getContents 'eats' stdin, which can't be used again.
You can process the result of getContents as many times as you want. > I'm forced to change all my IO code to the getContents way, which is not > possible. If your program contains so much IO code you should seriously consider refactoring. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe