On Mon, May 18, 2015 at 7:20 PM, Cody Goodman <codygman.consulting@gmail.com> wrote:
Can I use either template Haskell, GHC Generics, or something else to
get the list of Constructors in Codes? Then I could do `map show
codeSumTypeMembers` and get `["A0100A","A0500A"]`?

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.

IIRC, with Data.Typeable (deriving (Typeable)) you can do something like this for non-nullary constructors as well. It's more painful, though.

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net