Time

Ashley Yakeley ashley at semantic.org
Tue Jan 25 22:06:50 EST 2005


Ketil Malde <ketil+haskell at ii.uib.no> wrote:

> Would it be an idea to define something like (very rough draft here):
> 
>    data T = Y Int | M Int T | Wy Int T | Wm Int T | Dy Int T | Dm Int T
>        | Dw Int T | Hr Int T | Min Int T 
>        deriving (Eq,Show)
> 
> The idea is that time can be a year, or a month in some year, or a
> week in some year (yes, I know it's ambigous), week in month (in
> year), day in year, day in month in year, and so on.

This seems to be equivalent to DateTime::Incomplete in Perl's DateTime. 
If so I'd consider representing it more like this:

 data T = MkT
   y :: Maybe Int
   m :: Maybe Int
   wy :: Maybe Int
   wm :: Maybe Int
   ...

-- 
Ashley Yakeley, Seattle WA



More information about the Libraries mailing list