Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Time m a where
- now :: forall r. MemberWithError Time r => Sem r UTCTime
- runIO :: Member (Embed IO) r => Sem (Time ': r) a -> Sem r a
- runPure :: UTCTime -> Sem (Time ': r) a -> Sem r a
- oneHourAgo :: Member Time r => Sem r UTCTime
- twoHoursAgo :: Member Time r => Sem r UTCTime
- runDate :: Member Time r => Sem r Text
Documentation
>>>
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"