[Haskell-beginners] Generate a list of all constructors

Kees Bleijenberg K.Bleijenberg at lijbrandt.nl
Sat Nov 14 18:56:45 UTC 2015


In this piece of code

 

data Color = RED | BLUE | YELLOW

 

allColors :: [Color]

allColors = [RED, BLUE, YELLOW]

 

I have to remeber that if I add a Color, I have to add the color in
allColors too.  

Is there no better way to  add all possible colors in allColors?

 

Kees

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20151114/8b20ccba/attachment.html>


More information about the Beginners mailing list