[Haskell-cafe] Enum to String, and back?
nowgate at yahoo.com
Wed Apr 15 15:13:12 EDT 2009
Using Show it is possible to establish a relationship between an enum type
deriving (Show, Eq, Enum, Bounded)
and a String type to display it.
Red :: Color -> "Red" :: [Char]
Can one as easily establish a reverse relationship, i.e., convert a String type like "Red" back to its corresponding Color type?
"Red" :: [Char] -> Red :: Color
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe