[Haskell-beginners] Implementing Read

Daniel Fischer daniel.is.fischer at googlemail.com
Sun Sep 11 23:56:12 CEST 2011


On Sunday 11 September 2011, 23:27:53, Peter Hall wrote:
> Thanks,
> Good spot on the order. I'll get to that, but I still didn't have
> success with your other suggestion.

Oops, yes.

readsPrec returns a list of pairs, [(parsed value, remaining input)],

so

readsPrec _ (a:b) = 
    [(Card{suit = toSuit a, rank = r}, trl) | (r, trl) <- reads b]
  where
    toSuit 'c' = Club
    ...



More information about the Beginners mailing list