fmap f p = Parser ((.) (fmapEither (fmap1st f)) (runParser p)); fmapEither f e = case e of { Left x -> Left x; Right x -> Right (f x) }; fmap1st f p = case p of { (l, r) -> (f l, r) };