[Haskell-cafe] Re: Why is Day and Month bounded?

Henning Thielemann lemming at henning-thielemann.de
Fri Jul 14 05:24:13 EDT 2006


On Fri, 14 Jul 2006, Johan Holmquist wrote:

> I'll answer my own post to elaborate:
> 
> If Day (and Month) where NOT instances of Bounded, the following would
> be possible:
> 
> [Monday .. Sunday]
> => should return [Monday, Tuesday ... Saturday, Sunday]
> => but returns []

Why not
  [Monday, Tuesday ... Saturday, Sunday, Monday, Tuesday ... Saturday, Sunday] ?

Since the days are cycling, what is more natural about your result
compared to my one?

I assume the Bounded instance exists in order to allow loops like
   liftM2 (,) [0..] [minBound .. (maxBound::System.Time.Month)]


More information about the Haskell-Cafe mailing list