[Haskell-beginners] print all days of calendar
Daniel Fischer
daniel.is.fischer at web.de
Sun Dec 20 16:25:53 EST 2009
Am Sonntag 20 Dezember 2009 22:11:51 schrieb kane96 at 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".
More information about the Beginners
mailing list