[Haskell-cafe] Figuring out if an algebraic type is enumerated through Data.Generics?

Jules Bean jules at jellybean.co.uk
Wed May 7 01:47:27 EDT 2008

Alfonso Acosta wrote:
> It would certainly be difficult map any Haskell type to VHDL, so, by
> now we would be content to map enumerate algebraic types (i.e.
>  algebraic types whose all data constructors have arity zero, e.g.
> data Colors = Green | Blue | Red)

Wouldn't it be much simpler to use the standard deriveable classes 
Bounded and Enum, instead of an admittedly very clever trick using Data?

Metaprogramming comes in many shapes and sizes, and even the humble 
deriving (Show,Enum,Bounded,Ord,Eq) gives you quite some leverage..


More information about the Haskell-Cafe mailing list