
-------- Original-Nachricht --------
Datum: Sun, 20 Dec 2009 22:25:53 +0100 Von: Daniel Fischer
An: beginners@haskell.org CC: kane96@gmx.de Betreff: Re: [Haskell-beginners] print all days of calendar
Am Sonntag 20 Dezember 2009 22:11:51 schrieb kane96@gmx.de:
I implemented the first step which works if I fix the months (instead of the Month Enum) and just return the day and not an element of type Date
this works: calendar year = [ day | month <- [Jan, Feb], day <- [1..31], legalDate(day,month,year) == True ]
this doesn't work: calendar year = [ Date(day,month,year) | month <- Month, day <- [1..31], legalDate(day,month,year) == True ]
Date was a type synonym for the triple, so calendar year = [ (day,month,year) | month <- Month, day <- [1..31], legalDate(day,month,year)]
should be what you want. Note, "condition == True" is better written as "condition".
still have the problem that it says: "Not in scope: data constructor `Month'" but Month is declared as: data Month = Jan | Feb | Mar | Apr | May | Jun | Jul | Ago | Sep | Oct | Nov | Dec deriving (Eq,Enum,Show) -- Preisknaller: GMX DSL Flatrate für nur 16,99 Euro/mtl.! http://portal.gmx.net/de/go/dsl02