Safe Haskell | None |
---|---|
Language | Haskell2010 |
PlutusTx.Numeric
Synopsis
-
class
AdditiveSemigroup
a
where
- (+) :: a -> a -> a
-
class
AdditiveSemigroup
a =>
AdditiveMonoid
a
where
- zero :: a
-
class
AdditiveMonoid
a =>
AdditiveGroup
a
where
- (-) :: a -> a -> a
-
class
MultiplicativeSemigroup
a
where
- (*) :: a -> a -> a
-
class
MultiplicativeSemigroup
a =>
MultiplicativeMonoid
a
where
- one :: a
- type Semiring a = ( AdditiveMonoid a, MultiplicativeMonoid a)
- type Ring a = ( AdditiveGroup a, MultiplicativeMonoid a)
-
class
(
Ring
s,
AdditiveGroup
v) =>
Module
s v | v -> s
where
- scale :: s -> v -> v
- newtype Additive a = Additive a
- newtype Multiplicative a = Multiplicative a
- negate :: AdditiveGroup a => a -> a
- divMod :: Integer -> Integer -> ( Integer , Integer )
- quotRem :: Integer -> Integer -> ( Integer , Integer )
- abs :: ( Ord n, AdditiveGroup n) => n -> n
Type classes
class AdditiveSemigroup a where Source #
A
Semigroup
that it is sensible to describe using addition.
Instances
class AdditiveSemigroup a => AdditiveMonoid a where Source #
A
Monoid
that it is sensible to describe using addition and zero.
Instances
AdditiveMonoid Bool Source # | |
Defined in PlutusTx.Numeric |
|
AdditiveMonoid Integer Source # | |
Defined in PlutusTx.Numeric |
|
AdditiveMonoid Rational Source # | |
Defined in PlutusTx.Ratio |
|
Monoid a => AdditiveMonoid ( Additive a) Source # | |
Defined in PlutusTx.Numeric |
class AdditiveMonoid a => AdditiveGroup a where Source #
A
Group
that it is sensible to describe using addition, zero, and subtraction.
Instances
AdditiveGroup Integer Source # | |
AdditiveGroup Rational Source # | |
Group a => AdditiveGroup ( Additive a) Source # | |
class MultiplicativeSemigroup a where Source #
A
Semigroup
that it is sensible to describe using multiplication.
Instances
MultiplicativeSemigroup Bool Source # | |
MultiplicativeSemigroup Integer Source # | |
MultiplicativeSemigroup Rational Source # | |
Semigroup a => MultiplicativeSemigroup ( Multiplicative a) Source # | |
Defined in PlutusTx.Numeric Methods (*) :: Multiplicative a -> Multiplicative a -> Multiplicative a Source # |
class MultiplicativeSemigroup a => MultiplicativeMonoid a where Source #
A
Semigroup
that it is sensible to describe using multiplication and one.
Instances
MultiplicativeMonoid Bool Source # | |
Defined in PlutusTx.Numeric |
|
MultiplicativeMonoid Integer Source # | |
Defined in PlutusTx.Numeric |
|
MultiplicativeMonoid Rational Source # | |
Defined in PlutusTx.Ratio |
|
Monoid a => MultiplicativeMonoid ( Multiplicative a) Source # | |
Defined in PlutusTx.Numeric Methods one :: Multiplicative a Source # |
type Semiring a = ( AdditiveMonoid a, MultiplicativeMonoid a) Source #
A semiring.
type Ring a = ( AdditiveGroup a, MultiplicativeMonoid a) Source #
A ring.
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.
Helper newtypes
A newtype wrapper to derive
Additive
classes via.
Constructors
Additive a |
Instances
Group a => AdditiveGroup ( Additive a) Source # | |
Monoid a => AdditiveMonoid ( Additive a) Source # | |
Defined in PlutusTx.Numeric |
|
Semigroup a => AdditiveSemigroup ( Additive a) Source # | |
newtype Multiplicative a Source #
A newtype wrapper to derive
Multiplicative
classes via.
Constructors
Multiplicative a |
Instances
Monoid a => MultiplicativeMonoid ( Multiplicative a) Source # | |
Defined in PlutusTx.Numeric Methods one :: Multiplicative a Source # |
|
Semigroup a => MultiplicativeSemigroup ( Multiplicative a) Source # | |
Defined in PlutusTx.Numeric Methods (*) :: Multiplicative a -> Multiplicative a -> Multiplicative a Source # |
Helper functions
negate :: AdditiveGroup a => a -> a Source #
abs :: ( Ord n, AdditiveGroup n) => n -> n Source #
Absolute value for any
AdditiveGroup
.
Orphan instances
AdditiveSemigroup a => Semigroup ( Sum a) Source # | |
MultiplicativeSemigroup a => Semigroup ( Product a) Source # | |
AdditiveMonoid a => Monoid ( Sum a) Source # | |
MultiplicativeMonoid a => Monoid ( Product a) Source # | |