No subject


Thu Feb 24 17:58:36 CET 2011


many :: ReadP a -> ReadP [a]
-- ^ Parses zero or more occurrences of the given parser.
many p = return [] +++ many1 p

many1 :: ReadP a -> ReadP [a]
-- ^ Parses one or more occurrences of the given parser.
many1 p = liftM2 (:) p (many p)


So  `many` is defined in terms of `many1` and vice versa - completely
understandable, but here the argument (`p`) does not change. This is
above me right now. Anyone care to explain? I'd be grateful. Not that
I have to understand it, but it keeps pestering me during my lonely
hours.

/Fredrik



More information about the Beginners mailing list