atlas-cardano-0.6.2: 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.Natural

Description

 
Synopsis

Documentation

data GYNatural #

Cardano allows token mint amount to be as large as 9_223_372_036_854_775_807 which may not be represented correct in Javascript's number type, consequently, such large integers are to be better given as text in JSON. This wrapper type around Natural gives modified FromJSON and ToJSON instances so to work with Text instead.

Instances

Instances details
FromJSON GYNatural #
>>> Aeson.decode @GYNatural "\"123\""
Just (GYNatural 123)
>>> Aeson.eitherDecode @GYNatural "\"-123\""
Left "Error in $: underflow: -123 (should be a non-negative integer)"
>>> Aeson.eitherDecode @GYNatural "\"+123\""
Right (GYNatural 123)
>>> Aeson.eitherDecode @GYNatural "\"9223372036854775807\""
Right (GYNatural 9223372036854775807)
>>> Aeson.eitherDecode @GYNatural "\"123456789123456789123456789123456789123456789\""
Right (GYNatural 123456789123456789123456789123456789123456789)
>>> Aeson.eitherDecode @GYNatural "\"0011\""
Right (GYNatural 11)
>>> Aeson.eitherDecode @GYNatural "\"0f11\""
Left "Error in $: could not parse: `0f11'"
>>> Aeson.eitherDecode @GYNatural "\"-123456789123456789123456789123456789123456789\""
Left "Error in $: underflow: -123456789123456789123456789123456789123456789 (should be a non-negative integer)"
Instance details

Defined in GeniusYield.Types.Natural

ToJSON GYNatural #
>>> LBS8.putStrLn $ Aeson.encode (1234 :: GYNatural)
"1234"
>>> LBS8.putStrLn $ Aeson.encode (123456789123456789123456789123456789123456789 :: GYNatural)
"123456789123456789123456789123456789123456789"
Instance details

Defined in GeniusYield.Types.Natural

Enum GYNatural # 
Instance details

Defined in GeniusYield.Types.Natural

Generic GYNatural # 
Instance details

Defined in GeniusYield.Types.Natural

Associated Types

type Rep GYNaturalTypeType #

Methods

fromGYNaturalRep GYNatural x #

toRep GYNatural x → GYNatural #

Num GYNatural # 
Instance details

Defined in GeniusYield.Types.Natural

Read GYNatural # 
Instance details

Defined in GeniusYield.Types.Natural

Integral GYNatural # 
Instance details

Defined in GeniusYield.Types.Natural

Real GYNatural # 
Instance details

Defined in GeniusYield.Types.Natural

Show GYNatural # 
Instance details

Defined in GeniusYield.Types.Natural

Methods

showsPrecIntGYNaturalShowS #

showGYNaturalString #

showList ∷ [GYNatural] → ShowS #

PrintfArg GYNatural # 
Instance details

Defined in GeniusYield.Types.Natural

Eq GYNatural # 
Instance details

Defined in GeniusYield.Types.Natural

Methods

(==)GYNaturalGYNaturalBool #

(/=)GYNaturalGYNaturalBool #

Ord GYNatural # 
Instance details

Defined in GeniusYield.Types.Natural

FromHttpApiData GYNatural # 
Instance details

Defined in GeniusYield.Types.Natural

ToHttpApiData GYNatural # 
Instance details

Defined in GeniusYield.Types.Natural

ToParamSchema GYNatural # 
Instance details

Defined in GeniusYield.Types.Natural

Methods

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

ToSchema GYNatural #
>>> Aeson.encode (Swagger.toSchema (Proxy :: Proxy GYNatural))
"{\"description\":\"A natural number which is a non-negative integer. Minimum value is 0.\",\"example\":\"123456789123456789123456789123456789123456789\",\"type\":\"string\"}"
Instance details

Defined in GeniusYield.Types.Natural

type Rep GYNatural # 
Instance details

Defined in GeniusYield.Types.Natural

type Rep GYNatural = D1 ('MetaData "GYNatural" "GeniusYield.Types.Natural" "atlas-cardano-0.6.2-inplace" 'True) (C1 ('MetaCons "GYNatural" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Natural)))