module Data.TimeVal ( TimeVal(..) ) where import Algebra -- |A type wrapper that adds a Bounded instance for types that don't possess one. data TimeVal t = Always | Since t | Never deriving (Show,Eq,Ord) instance Functor TimeVal where map f (Since a) = Since (f a) map _ Always = Always map _ Never = Never instance Unit TimeVal where pure = Since instance Applicative TimeVal instance Monad TimeVal where join (Since b) = b join Always = Always join Never = Never instance Foldable TimeVal where fold (Since t) = t fold _ = zero instance Traversable TimeVal where sequence (Since t) = Since<$>t sequence Always = pure Always sequence Never = pure Never instance Bounded (TimeVal t) where minBound = Always ; maxBound = Never