15 Apr
2009
15 Apr
'09
3:17 p.m.
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.