<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Thanks guys. It works like a charm.<br><br>Michael<br><br>--- On <b>Wed, 4/15/09, Rahul Kapoor <i>&lt;rk@trie.org&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Rahul Kapoor &lt;rk@trie.org&gt;<br>Subject: Re: [Haskell-cafe] Enum to String, and back?<br>To: <br>Cc: haskell-cafe@haskell.org<br>Date: Wednesday, April 15, 2009, 3:20 PM<br><br><div class="plainMail">On Wed, Apr 15, 2009 at 3:13 PM, michael rice &lt;<a ymailto="mailto:nowgate@yahoo.com" href="/mc/compose?to=nowgate@yahoo.com">nowgate@yahoo.com</a>&gt; wrote:<br>&gt; Using Show it is possible to establish a relationship between an enum type<br>&gt; and a String type to display it.<br>&gt; Can one as easily establish a reverse relationship, i.e., convert a String<br>&gt; type like "Red" back to its corresponding Color
 type?<br>&gt;<br>Make it an instance of the Read type class.<br><a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t%3ARead" target="_blank">http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t%3ARead</a><br><br>That will allow you to write -<br><br>read "Red" :: Color<br>=&gt; Red<br><br>HTH<br>Rahul<br>_______________________________________________<br>Haskell-Cafe mailing list<br><a ymailto="mailto:Haskell-Cafe@haskell.org" href="/mc/compose?to=Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br></div></blockquote></td></tr></table><br>