plutus-tx-0.1.0.0: Libraries for Plutus Tx and its prelude
Safe HaskellNone
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 Bool Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

(+) :: Bool -> Bool -> Bool Source #

AdditiveSemigroup Integer Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

(+) :: Integer -> Integer -> Integer Source #

AdditiveSemigroup Rational Source # 
Instance details

Defined in PlutusTx.Ratio

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 Bool Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

zero :: Bool Source #

AdditiveMonoid Integer Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

zero :: Integer Source #

AdditiveMonoid Rational Source # 
Instance details

Defined in PlutusTx.Ratio

Methods

zero :: Rational Source #

Monoid a => AdditiveMonoid (Additive a) Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

zero :: Additive 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 Integer Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

(-) :: Integer -> Integer -> Integer Source #

AdditiveGroup Rational Source # 
Instance details

Defined in PlutusTx.Ratio

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 Bool Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

(*) :: Bool -> Bool -> Bool Source #

MultiplicativeSemigroup Integer Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

(*) :: Integer -> Integer -> Integer Source #

MultiplicativeSemigroup Rational Source # 
Instance details

Defined in PlutusTx.Ratio

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 Bool Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

one :: Bool Source #

MultiplicativeMonoid Integer Source # 
Instance details

Defined in PlutusTx.Numeric

Methods

one :: Integer Source #

MultiplicativeMonoid Rational Source # 
Instance details

Defined in PlutusTx.Ratio

Methods

one :: Rational Source #

Monoid a => MultiplicativeMonoid (Multiplicative a) Source # 
Instance details

Defined in PlutusTx.Numeric

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

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

zero :: Additive 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

Semigroup a => MultiplicativeSemigroup (Multiplicative a) Source # 
Instance details

Defined in PlutusTx.Numeric

Helper functions

negate :: AdditiveGroup a => a -> a Source #

divMod :: Integer -> Integer -> (Integer, Integer) Source #

Simultaneous div and mod.

quotRem :: Integer -> Integer -> (Integer, Integer) Source #

Simultaneous quot and rem.

abs :: (Ord n, AdditiveGroup n) => n -> n Source #

Absolute value for any AdditiveGroup.

Orphan instances

AdditiveSemigroup a => Semigroup (Sum a) Source # 
Instance details

Methods

(<>) :: Sum a -> Sum a -> Sum a Source #

MultiplicativeSemigroup a => Semigroup (Product a) Source # 
Instance details

Methods

(<>) :: Product a -> Product a -> Product a Source #

AdditiveMonoid a => Monoid (Sum a) Source # 
Instance details

Methods

mempty :: Sum a Source #

MultiplicativeMonoid a => Monoid (Product a) Source # 
Instance details

Methods

mempty :: Product a Source #