atlas-cardano-0.6.3: Application backend for Plutus smart contracts on Cardano
Copyright(c) 2023 GYELD GMBH
LicenseApache 2.0
Maintainer[email protected]
Stabilitydevelop
Safe HaskellSafe-Inferred
LanguageGHC2021

GeniusYield.Types.Time

Description

 
Synopsis

Documentation

class FormatTime t where #

Methods

formatCharacterBoolCharMaybe (FormatOptions → t → String) #

Since: time-1.9.1

Instances

Instances details
FormatTime DotNetTime 
Instance details

Defined in Data.Aeson.Types.Internal

FormatTime GYTime # 
Instance details

Defined in GeniusYield.Types.Time

Methods

formatCharacterBoolCharMaybe (FormatOptionsGYTimeString) #

class ParseTime t where #

The class of types which can be parsed given a UNIX-style time format string.

Minimal complete definition

parseTimeSpecifier, buildTime

Methods

substituteTimeSpecifierProxy t → TimeLocaleCharMaybe String #

Since: time-1.9.1

parseTimeSpecifierProxy t → TimeLocaleMaybe ParseNumericPaddingCharReadP String #

Get the string corresponding to the given format specifier.

Since: time-1.9.1

buildTime #

Arguments

TimeLocale

The time locale.

→ [(Char, String)]

Pairs of format characters and the corresponding part of the input.

Maybe t 

Builds a time value from a parsed input string. If the input does not include all the information needed to construct a complete value, any missing parts should be taken from 1970-01-01 00:00:00 +0000 (which was a Thursday). In the absence of %C or %Y, century is 1969 - 2068.

Since: time-1.9.1

gyIso8601ShowGYTimeString #

>>> gyIso8601Show (timeFromPlutus 0)
"1970-01-01T00:00:00Z"

gyIso8601ParseMMonadFail m ⇒ String → m GYTime #

>>> gyIso8601ParseM @Maybe "1970-01-01T00:00:33.333Z"
Just (GYTime 33.333s)
>>> gyIso8601ParseM @Maybe "1970-01-01T00:00:33.333"
Nothing

data GYTime #

Instances

Instances details
FromJSON GYTime #
>>> Aeson.eitherDecode @GYTime "\"1970-01-01T00:00:00Z\""
Right (GYTime 0s)
>>> Aeson.eitherDecode @GYTime "\"1970-01-01T00:00:00\""
Left "Error in $: can't parse '1970-01-01T00:00:00' as GYTime in ISO8601 format"
Instance details

Defined in GeniusYield.Types.Time

ToJSON GYTime #
>>> LBS8.putStrLn $ Aeson.encode $ timeFromPlutus 0
"1970-01-01T00:00:00Z"
Instance details

Defined in GeniusYield.Types.Time

IsString GYTime #
>>> "1970-01-01T00:00:00Z" :: GYTime
GYTime 0s
>>> "1970-01-01T00:00:00" :: GYTime
*** Exception: can't parse '1970-01-01T00:00:00' as GYTime in ISO8601 format
...
Instance details

Defined in GeniusYield.Types.Time

Methods

fromStringStringGYTime #

Read GYTime # 
Instance details

Defined in GeniusYield.Types.Time

Show GYTime # 
Instance details

Defined in GeniusYield.Types.Time

Methods

showsPrecIntGYTimeShowS #

showGYTimeString #

showList ∷ [GYTime] → ShowS #

PrintfArg GYTime #
>>> printf "%s\n" $ timeFromPlutus 1000
1970-01-01T00:00:01Z
Instance details

Defined in GeniusYield.Types.Time

FromField GYTime #
>>> Csv.runParser $ Csv.parseField @GYTime "1970-01-01T00:00:00Z"
Right (GYTime 0s)
>>> Csv.runParser $ Csv.parseField @GYTime "not a time"
Left "can't parse 'not a time' as GYTime in ISO8601 format"
Instance details

Defined in GeniusYield.Types.Time

Methods

parseFieldFieldParser GYTime #

ToField GYTime #
>>> Csv.toField @GYTime "1970-01-01T00:00:00Z"
"1970-01-01T00:00:00Z"
Instance details

Defined in GeniusYield.Types.Time

Methods

toFieldGYTimeField #

Eq GYTime # 
Instance details

Defined in GeniusYield.Types.Time

Methods

(==)GYTimeGYTimeBool #

(/=)GYTimeGYTimeBool #

Ord GYTime # 
Instance details

Defined in GeniusYield.Types.Time

Methods

compareGYTimeGYTimeOrdering #

(<)GYTimeGYTimeBool #

(<=)GYTimeGYTimeBool #

(>)GYTimeGYTimeBool #

(>=)GYTimeGYTimeBool #

maxGYTimeGYTimeGYTime #

minGYTimeGYTimeGYTime #

FromHttpApiData GYTime #
>>> Web.parseUrlPiece @GYTime "1970-01-01T00:00:00Z"
Right (GYTime 0s)
>>> Web.parseUrlPiece @GYTime "1970-01-01T00:00:00"
Left "can't parse '1970-01-01T00:00:00' as GYTime in ISO8601 format"
Instance details

Defined in GeniusYield.Types.Time

ToHttpApiData GYTime #
>>> Web.toUrlPiece $ timeFromPlutus 0
"1970-01-01T00:00:00Z"
Instance details

Defined in GeniusYield.Types.Time

ToParamSchema GYTime # 
Instance details

Defined in GeniusYield.Types.Time

Methods

toParamSchema ∷ ∀ (t ∷ SwaggerKind Type). Proxy GYTimeParamSchema t #

ToSchema GYTime # 
Instance details

Defined in GeniusYield.Types.Time

FormatTime GYTime # 
Instance details

Defined in GeniusYield.Types.Time

Methods

formatCharacterBoolCharMaybe (FormatOptionsGYTimeString) #

ParseTime GYTime # 
Instance details

Defined in GeniusYield.Types.Time

timeFromPlutusPOSIXTimeGYTime #

>>> timeFromPlutus 12345
GYTime 12.345s

timeToPlutusGYTimePOSIXTime #

>>> timeToPlutus $ timeFromPlutus 31415
POSIXTime {getPOSIXTime = 31415}

timeToPOSIXGYTimePOSIXTime #

>>> timeToPOSIX (timeFromPOSIX 12346)
12346s

timeFromPOSIXPOSIXTimeGYTime #

>>> timeFromPOSIX 12346
GYTime 12346s