Safe Haskell | Safe |
---|---|
Language | Haskell98 |
- class IsTime t where
- hour :: t -> Integer
- minute :: t -> Integer
- second :: t -> Integer
- secondFraction :: t -> Rational
- setHour :: Monad m => Integer -> t -> m t
- setMinute :: Monad m => Integer -> t -> m t
- setSecond :: Monad m => Integer -> t -> m t
- setSecondFraction :: Monad m => Rational -> t -> m t
- addHours :: Monad m => Integer -> t -> m t
- addMinutes :: Monad m => Integer -> t -> m t
- addSeconds :: Monad m => Integer -> t -> m t
- addSecondFractions :: Monad m => Rational -> t -> m t
Documentation
This class captures the concept of a 24-hour clock time during a day.
Returns values in the range 0 to 23.
Returns values in the range 0 to 59.
Returns values in the range 0 to 59.
secondFraction :: t -> Rational Source
Returns values in the range 0.0 <= x < 1.0.
setHour :: Monad m => Integer -> t -> m t Source
Accepts values in the range 0 to 23.
The function fails if the result cannot be represented by the type (cannot happen for Time
and DateTime
).
setMinute :: Monad m => Integer -> t -> m t Source
Accepts values in the range 0 to 59.
The function fails if the result cannot be represented by the type (cannot happen for Time
and DateTime
).
setSecond :: Monad m => Integer -> t -> m t Source
Accepts values in the range 0 to 59.
The function fails if the result cannot be represented by the type (cannot happen for Time
and DateTime
).
setSecondFraction :: Monad m => Rational -> t -> m t Source
Accepts values in the range 0.0 <= x < 1.0.
The function fails if the result cannot be represented by the type (cannot happen for Time
and DateTime
).
addHours :: Monad m => Integer -> t -> m t Source
Adds an arbitrary count of hours (positive or negative).
addMinutes :: Monad m => Integer -> t -> m t Source
Adds an arbitrary count of minutes (positive or negative).
addSeconds :: Monad m => Integer -> t -> m t Source
Adds an arbitrary count of seconds (positive or negative).
- Full minutes flow over to
addMinutes
. - Fails if the result cannot be represented by the type (cannot happen for
Time
andDateTime
).
addSecondFractions :: Monad m => Rational -> t -> m t Source
Adds an arbitrary second fraction (positive or negative).
- Full seconds flow over to
addSeconds
. - Instances of this class are not required to preserve full precision (although
Time
andDateTime
do so). - Fails if the result cannot be represented by the type (cannot happen for
Time
andDateTime
).