atlas-0.1.0.0: Application backend for Plutus smart contracts on Cardano
Copyright(c) 2023 GYELD GMBH
LicenseApache 2.0
Maintainersupport@geniusyield.co
Stabilitydevelop
Safe HaskellNone
LanguageHaskell2010

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

Methods

formatCharacterBoolCharMaybe (FormatOptions → DotNetTime → String) #

FormatTime Month 
Instance details

Defined in Data.Time.Calendar.Month.Compat

Methods

formatCharacterBoolCharMaybe (FormatOptions → Month → String) #

FormatTime GYTime # 
Instance details

Defined in GeniusYield.Types.Time

Methods

formatCharacterBoolCharMaybe (FormatOptions → GYTimeString) #

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

substituteTimeSpecifier ∷ proxy t → TimeLocaleCharMaybe String #

Since: time-1.9.1

parseTimeSpecifier ∷ proxy t → TimeLocaleMaybe ParseNumericPadding → CharReadP 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

Instances

Instances details
ParseTime GYTime # 
Instance details

Defined in GeniusYield.Types.Time

Methods

substituteTimeSpecifier ∷ proxy GYTimeTimeLocaleCharMaybe String #

parseTimeSpecifier ∷ proxy GYTimeTimeLocaleMaybe ParseNumericPadding → CharReadP String #

buildTimeTimeLocale → [(Char, String)] → Maybe GYTime #

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
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 #

Read GYTime # 
Instance details

Defined in GeniusYield.Types.Time

Show GYTime # 
Instance details

Defined in GeniusYield.Types.Time

Methods

showsPrecIntGYTimeShowS #

showGYTimeString #

showList ∷ [GYTime] → ShowS #

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 #

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

Defined in GeniusYield.Types.Time

FormatTime GYTime # 
Instance details

Defined in GeniusYield.Types.Time

Methods

formatCharacterBoolCharMaybe (FormatOptions → GYTimeString) #

ParseTime GYTime # 
Instance details

Defined in GeniusYield.Types.Time

Methods

substituteTimeSpecifier ∷ proxy GYTimeTimeLocaleCharMaybe String #

parseTimeSpecifier ∷ proxy GYTimeTimeLocaleMaybe ParseNumericPadding → CharReadP String #

buildTimeTimeLocale → [(Char, String)] → Maybe GYTime #

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

Methods

parseJSON ∷ Value → Parser GYTime #

parseJSONList ∷ Value → Parser [GYTime] #

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

Defined in GeniusYield.Types.Time

Methods

toJSONGYTime → Value #

toEncodingGYTime → Encoding #

toJSONList ∷ [GYTime] → Value #

toEncodingList ∷ [GYTime] → Encoding #

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

Defined in GeniusYield.Types.Time

Methods

toFieldGYTime → Field

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

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

parseField ∷ Field → Parser GYTime

ToParamSchema GYTime # 
Instance details

Defined in GeniusYield.Types.Time

Methods

toParamSchema ∷ ∀ (t ∷ SwaggerKind Type). Proxy GYTime → ParamSchema t

ToSchema GYTime # 
Instance details

Defined in GeniusYield.Types.Time

Methods

declareNamedSchemaProxy GYTime → Declare (Definitions Schema) NamedSchema

timeFromPlutus ∷ POSIXTime → GYTime #

>>> timeFromPlutus 12345
GYTime 12.345s

timeToPlutusGYTime → POSIXTime #

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

timeToPOSIXGYTimePOSIXTime #

>>> timeToPOSIX (timeFromPOSIX 12346)
12346s

timeFromPOSIXPOSIXTimeGYTime #

>>> timeFromPOSIX 12346
GYTime 12346s