nixpkgs-update-0.3.0: Tool for semi-automatic updating of nixpkgs repository
Safe HaskellNone
LanguageHaskell2010

Time

Synopsis

Documentation

data Time m a where Source #

Constructors

Now :: Time m UTCTime 

Instances

Instances details
type DefiningModule (Time :: k -> Type -> Type) Source # 
Instance details

Defined in Time

type DefiningModule (Time :: k -> Type -> Type) = "Time"

now :: forall r. MemberWithError Time r => Sem r UTCTime Source #

runIO :: Member (Embed IO) r => Sem (Time ': r) a -> Sem r a Source #

runPure :: UTCTime -> Sem (Time ': r) a -> Sem r a Source #

>>> import Data.Time.Format (parseTimeOrError)
>>> let exampleCurrentTime = parseTimeOrError False defaultTimeLocale "%Y-%-m-%-d" "2019-06-06" :: UTCTime

Examples:

>>> run $ runPure exampleCurrentTime oneHourAgo
2019-06-05 23:00:00 UTC

twoHoursAgo :: Member Time r => Sem r UTCTime Source #

Return the UTC time 2 hours ago

Examples:

>>> run $ runPure exampleCurrentTime twoHoursAgo
2019-06-05 22:00:00 UTC

runDate :: Member Time r => Sem r Text Source #

Return the current ISO8601 date and time without timezone

TODO: switch to Data.Time.Format.ISO8601 once time-1.9.0 is available unix depends on an earlier version currently https://github.com/haskell/unix/issues/131

Examples:

>>> run $ runPure exampleCurrentTime runDate
"2019-06-06T00:00:00"