plutus-core-1.36.0.0: Language library for Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.SatInt

Description

Adapted from SafeInt to perform saturating arithmetic (i.e. returning max or min bounds) instead of throwing on overflow.

This is not quite as fast as using Int or Int64 directly, but we need the safety.

Synopsis

Documentation

data SatInt Source #

Instances

Instances details
FromJSON SatInt Source # 
Instance details

Defined in Data.SatInt

Methods

parseJSON ∷ Value → Parser SatInt

parseJSONList ∷ Value → Parser [SatInt]

omittedFieldMaybe SatInt

ToJSON SatInt Source # 
Instance details

Defined in Data.SatInt

Methods

toJSONSatInt → Value

toEncodingSatInt → Encoding

toJSONList ∷ [SatInt] → Value

toEncodingList ∷ [SatInt] → Encoding

omitFieldSatIntBool

Bits SatInt Source # 
Instance details

Defined in Data.SatInt

FiniteBits SatInt Source # 
Instance details

Defined in Data.SatInt

Bounded SatInt Source # 
Instance details

Defined in Data.SatInt

Generic SatInt Source # 
Instance details

Defined in Data.SatInt

Associated Types

type Rep SatIntTypeType Source #

Methods

fromSatIntRep SatInt x Source #

toRep SatInt x → SatInt Source #

Num SatInt Source #

In the Num instance, we plug in our own addition, multiplication and subtraction function that perform overflow-checking.

Instance details

Defined in Data.SatInt

Read SatInt Source # 
Instance details

Defined in Data.SatInt

Show SatInt Source # 
Instance details

Defined in Data.SatInt

FromField SatInt Source # 
Instance details

Defined in Data.SatInt

Methods

parseField ∷ Field → Parser SatInt

NFData SatInt Source # 
Instance details

Defined in Data.SatInt

Methods

rnfSatInt → () Source #

Eq SatInt Source # 
Instance details

Defined in Data.SatInt

Methods

(==)SatIntSatIntBool Source #

(/=)SatIntSatIntBool Source #

Ord SatInt Source # 
Instance details

Defined in Data.SatInt

NoThunks SatInt Source # 
Instance details

Defined in Data.SatInt

Prim SatInt Source # 
Instance details

Defined in Data.SatInt

Serialise SatInt Source # 
Instance details

Defined in Data.SatInt

Lift SatInt Source # 
Instance details

Defined in Data.SatInt

Methods

liftQuote m ⇒ SatInt → m Exp Source #

liftTyped ∷ ∀ (m ∷ TypeType). Quote m ⇒ SatIntCode m SatInt Source #

type Rep SatInt Source # 
Instance details

Defined in Data.SatInt

type Rep SatInt = D1 ('MetaData "SatInt" "Data.SatInt" "plutus-core-1.36.0.0-inplace-satint" 'True) (C1 ('MetaCons "SI" 'PrefixI 'True) (S1 ('MetaSel ('Just "unSatInt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))

unsafeToSatIntIntSatInt Source #

Wrap an Int as a SatInt. This is unsafe because the Int can be a result of an arbitrary potentially underflowing/overflowing operation.

fromSatInt ∷ ∀ a. Num a ⇒ SatInt → a Source #

An optimized version of fromIntegral . unSatInt.