plutus-tx-1.38.0.0: Libraries for Plutus Tx and its prelude
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusTx.Numeric

Synopsis

Type classes

class AdditiveSemigroup a where Source #

A Semigroup that it is sensible to describe using addition.

Methods

(+) ∷ a → a → a infixl 6 Source #

Instances

Instances details
AdditiveSemigroup Rational Source # 
Instance details

Defined in PlutusTx.Ratio

Methods

(+)RationalRationalRational Source #

AdditiveSemigroup Integer Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

(+)IntegerIntegerInteger Source #

AdditiveSemigroup Bool Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

(+)BoolBoolBool Source #

Semigroup a ⇒ AdditiveSemigroup (Additive a) Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

(+)Additive a → Additive a → Additive a Source #

class AdditiveSemigroup a ⇒ AdditiveMonoid a where Source #

A Monoid that it is sensible to describe using addition and zero.

Methods

zero ∷ a Source #

Instances

Instances details
AdditiveMonoid Rational Source # 
Instance details

Defined in PlutusTx.Ratio

Methods

zeroRational Source #

AdditiveMonoid Integer Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

zeroInteger Source #

AdditiveMonoid Bool Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

zeroBool Source #

Monoid a ⇒ AdditiveMonoid (Additive a) Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

zeroAdditive a Source #

class AdditiveMonoid a ⇒ AdditiveGroup a where Source #

A Group that it is sensible to describe using addition, zero, and subtraction.

Methods

(-) ∷ a → a → a infixl 6 Source #

Instances

Instances details
AdditiveGroup Rational Source # 
Instance details

Defined in PlutusTx.Ratio

Methods

(-)RationalRationalRational Source #

AdditiveGroup Integer Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

(-)IntegerIntegerInteger Source #

Group a ⇒ AdditiveGroup (Additive a) Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

(-)Additive a → Additive a → Additive a Source #

class MultiplicativeSemigroup a where Source #

A Semigroup that it is sensible to describe using multiplication.

Methods

(*) ∷ a → a → a infixl 7 Source #

Instances

Instances details
MultiplicativeSemigroup Rational Source # 
Instance details

Defined in PlutusTx.Ratio

Methods

(*)RationalRationalRational Source #

MultiplicativeSemigroup Integer Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

(*)IntegerIntegerInteger Source #

MultiplicativeSemigroup Bool Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

(*)BoolBoolBool Source #

Semigroup a ⇒ MultiplicativeSemigroup (Multiplicative a) Source # 
Instance details

Defined in PlutusTx.Numeric

class MultiplicativeSemigroup a ⇒ MultiplicativeMonoid a where Source #

A Semigroup that it is sensible to describe using multiplication and one.

Methods

one ∷ a Source #

Instances

Instances details
MultiplicativeMonoid Rational Source # 
Instance details

Defined in PlutusTx.Ratio

Methods

oneRational Source #

MultiplicativeMonoid Integer Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

oneInteger Source #

MultiplicativeMonoid Bool Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

oneBool Source #

Monoid a ⇒ MultiplicativeMonoid (Multiplicative a) Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

oneMultiplicative a Source #

class (Ring s, AdditiveGroup v) ⇒ Module s v | v → s where Source #

A module, with a type of scalars which can be used to scale the values.

Methods

scale ∷ s → v → v Source #

Instances

Instances details
Module Integer Rational Source # 
Instance details

Defined in PlutusTx.Ratio

Methods

scaleIntegerRationalRational Source #

Helper newtypes

newtype Additive a Source #

A newtype wrapper to derive Additive classes via.

Constructors

Additive a 

Instances

Instances details
Group a ⇒ AdditiveGroup (Additive a) Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

(-)Additive a → Additive a → Additive a Source #

Monoid a ⇒ AdditiveMonoid (Additive a) Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

zeroAdditive a Source #

Semigroup a ⇒ AdditiveSemigroup (Additive a) Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

(+)Additive a → Additive a → Additive a Source #

newtype Multiplicative a Source #

A newtype wrapper to derive Multiplicative classes via.

Constructors

Multiplicative a 

Instances

Instances details
Monoid a ⇒ MultiplicativeMonoid (Multiplicative a) Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

oneMultiplicative a Source #

Semigroup a ⇒ MultiplicativeSemigroup (Multiplicative a) Source # 
Instance details

Defined in PlutusTx.Numeric

Helper functions

negateAdditiveGroup a ⇒ a → a Source #

divModIntegerInteger → (Integer, Integer) Source #

Simultaneous div and mod.

quotRemIntegerInteger → (Integer, Integer) Source #

Simultaneous quot and rem.

abs ∷ (Ord n, AdditiveGroup n) ⇒ n → n Source #

Absolute value for any AdditiveGroup.

Orphan instances

MultiplicativeMonoid a ⇒ Monoid (Product a) Source # 
Instance details

Methods

memptyProduct a Source #

AdditiveMonoid a ⇒ Monoid (Sum a) Source # 
Instance details

Methods

memptySum a Source #

MultiplicativeSemigroup a ⇒ Semigroup (Product a) Source # 
Instance details

Methods

(<>)Product a → Product a → Product a Source #

AdditiveSemigroup a ⇒ Semigroup (Sum a) Source # 
Instance details

Methods

(<>)Sum a → Sum a → Sum a Source #