
15 Apr
2009
15 Apr
'09
3:20 p.m.
On Wed, Apr 15, 2009 at 3:13 PM, michael rice
Using Show it is possible to establish a relationship between an enum type and a String type to display it. Can one as easily establish a reverse relationship, i.e., convert a String type like "Red" back to its corresponding Color type?
Make it an instance of the Read type class. http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t%3ARead That will allow you to write - read "Red" :: Color => Red HTH Rahul