Hi Michael,

michael rice wrote:
Can one as easily establish a reverse relationship, i.e., convert a String type like "Red" back to its corresponding Color type?

So that

"Red" :: [Char] -> Red :: Color

Yes, simply add Read to your list of to be derived type classes. Then you can say:

> read "Red" :: Color

HTH,

Martijn.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to