[Haskell-cafe] IO in lists
David House
dmhouse at gmail.com
Tue Jan 16 14:19:06 EST 2007
On 16/01/07, Yitzchak Gale <gale at sefer.org> wrote:
> listChars2 :: ListT IO Char
> listChars2 = do
> c <- lift getChar
> if c == 'q'
> then return c
> else return c `mplus` listChars2
It's probably eaiser to work with normal lists:
listChars :: IO [Char]
listChars = do
c <- getChar
if c == 'q'
then return c
else liftM2 (:) (return c) listChars
--
-David House, dmhouse at gmail.com
More information about the Haskell-Cafe
mailing list