<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, May 18, 2015 at 7:20 PM, Cody Goodman <span dir="ltr"><<a href="mailto:codygman.consulting@gmail.com" target="_blank">codygman.consulting@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":1f8" class="a3s" style="overflow:hidden">Can I use either template Haskell, GHC Generics, or something else to<br>
get the list of Constructors in Codes? Then I could do `map show<br>
codeSumTypeMembers` and get `["A0100A","A0500A"]`?<br></div></blockquote></div><br>Derive Enum and Bounded as well, and you can then use minBound and maxBound along with show. This will only work for nullary constructors, though.<br><br>IIRC, with Data.Typeable (deriving (Typeable)) you can do something like this for non-nullary constructors as well. It's more painful, though.<br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>brandon s allbery kf8nh                               sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>                                  <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div><div>unix, openafs, kerberos, infrastructure, xmonad        <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div></div>
</div></div>