Copyright | (C) 2016 Jason Johnson |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Jason Johnson <jason.johnson.081@gmail.com> |
Stability | experimental |
Portability | TBD |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
An LocalTime
represents a time of day, with no reference to a particular calendar, time zone or date.
This module contains constructors and functions for working with LocalTime
.
Normalization
A clock time can be from 00:00:00.000 to 23:59:59.99.. Adding 1 minute to 23:59:00 will cause it to roll over to 00:00:00.
Synopsis
- data LocalTime
- class HasLocalTime lt where
- type Hour = Int
- type Minute = Int
- type Second = Int
- type Nanosecond = Int
- localTime :: MonadThrow m => Hour -> Minute -> Second -> Nanosecond -> m LocalTime
- data InvalidHourException
- data InvalidMinuteException
- data InvalidSecondException
- data InvalidNanoSecondException
Types
Represents a specific time of day with no reference to any calendar, date or time zone.
Instances
Show LocalTime Source # | |
Eq LocalTime Source # | |
Ord LocalTime Source # | |
Defined in Data.HodaTime.CalendarDateTime.Internal | |
HasLocalTime LocalTime Source # | |
Defined in Data.HodaTime.LocalTime.Internal hour :: Functor f => (Hour -> f Hour) -> LocalTime -> f LocalTime Source # minute :: Functor f => (Minute -> f Minute) -> LocalTime -> f LocalTime Source # second :: Functor f => (Second -> f Second) -> LocalTime -> f LocalTime Source # nanosecond :: Functor f => (Nanosecond -> f Nanosecond) -> LocalTime -> f LocalTime Source # |
class HasLocalTime lt where Source #
hour :: Functor f => (Hour -> f Hour) -> lt -> f lt Source #
Lens for the hour component of the LocalTime
minute :: Functor f => (Minute -> f Minute) -> lt -> f lt Source #
Lens for the minute component of the LocalTime
second :: Functor f => (Second -> f Second) -> lt -> f lt Source #
Lens for the second component of the LocalTime
nanosecond :: Functor f => (Nanosecond -> f Nanosecond) -> lt -> f lt Source #
Lens for the nanoseconds component of the LocalTime
. NOTE: no effort is made to detect nano overflow. They will simply roll over on overflow without affecting the rest of the time.
Instances
HasLocalTime LocalTime Source # | |
Defined in Data.HodaTime.LocalTime.Internal hour :: Functor f => (Hour -> f Hour) -> LocalTime -> f LocalTime Source # minute :: Functor f => (Minute -> f Minute) -> LocalTime -> f LocalTime Source # second :: Functor f => (Second -> f Second) -> LocalTime -> f LocalTime Source # nanosecond :: Functor f => (Nanosecond -> f Nanosecond) -> LocalTime -> f LocalTime Source # | |
IsCalendar cal => HasLocalTime (CalendarDateTime cal) Source # | |
Defined in Data.HodaTime.LocalTime.Internal hour :: Functor f => (Hour -> f Hour) -> CalendarDateTime cal -> f (CalendarDateTime cal) Source # minute :: Functor f => (Minute -> f Minute) -> CalendarDateTime cal -> f (CalendarDateTime cal) Source # second :: Functor f => (Second -> f Second) -> CalendarDateTime cal -> f (CalendarDateTime cal) Source # nanosecond :: Functor f => (Nanosecond -> f Nanosecond) -> CalendarDateTime cal -> f (CalendarDateTime cal) Source # |
type Nanosecond = Int Source #
Constructors
localTime :: MonadThrow m => Hour -> Minute -> Second -> Nanosecond -> m LocalTime Source #
Create a new LocalTime
from an hour, minute, second and nanosecond if values are valid
Exceptions
data InvalidHourException Source #
Given hour was not valid
Instances
Exception InvalidHourException Source # | |
Show InvalidHourException Source # | |
Defined in Data.HodaTime.LocalTime.Internal showsPrec :: Int -> InvalidHourException -> ShowS # show :: InvalidHourException -> String # showList :: [InvalidHourException] -> ShowS # |
data InvalidMinuteException Source #
Given minute was not valid
Instances
Exception InvalidMinuteException Source # | |
Show InvalidMinuteException Source # | |
Defined in Data.HodaTime.LocalTime.Internal showsPrec :: Int -> InvalidMinuteException -> ShowS # show :: InvalidMinuteException -> String # showList :: [InvalidMinuteException] -> ShowS # |
data InvalidSecondException Source #
Given second was not valid
Instances
Exception InvalidSecondException Source # | |
Show InvalidSecondException Source # | |
Defined in Data.HodaTime.LocalTime.Internal showsPrec :: Int -> InvalidSecondException -> ShowS # show :: InvalidSecondException -> String # showList :: [InvalidSecondException] -> ShowS # |
data InvalidNanoSecondException Source #
Given nanosecond was not valid