
19 Jul
2010
19 Jul
'10
8:14 a.m.
On Mon, Jul 19, 2010 at 9:41 AM, Michael Mossey
digitList :: Parser [Int] digitList = do d <- digit remainder <- digitList return $ read [d] : remainder <|> return []
I would write digitList :: Parser [Int] digitList = do l <- many digit let l' = map ( read -- read the string . (: []) -- convert the digit from a char to a string so I can "read" it ) l return l' That can be shortened to : digitList :: Parser [Int] digitList = map ( read.(:[])) `fmap` many digit David.