
Hum.... I must lost my mind....
Thank you.
On Mon, Jul 13, 2009 at 3:33 PM, Ketil Malde
Magicloud Magiclouds
writes: 43 instance Read Attribute where 44 readsPrec _ str = [ (mkAttr attr_ color, rest) | (attr_, rest1) <- lex str 45 , (color, rest) <- case reads rest1 of 46 [(color_, rest_)] -> (color_, rest_) 47 _ -> (Color 0 0 0, rest1) ]
Doesn't the (color,rest) pair in the list comprehension need to be pulled from a list? The case expression only returns a pair so you're basically left with [something| something, (color,rest) <- (somecolor,somerest) ]
Since you're only producing a single (color,rest) for each rest1, you might consider lifting it out in the left side of the list comprehension.
-k -- If I haven't seen further, it is by standing in the footprints of giants
-- 竹密岂妨流水过 山高哪阻野云飞