Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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 Rational Source # | |
Defined in PlutusTx.Ratio | |
AdditiveMonoid Integer Source # | |
Defined in PlutusTx.Numeric | |
AdditiveMonoid Bool Source # | |
Defined in PlutusTx.Numeric | |
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
class MultiplicativeSemigroup a where Source #
A Semigroup
that it is sensible to describe using multiplication.
Instances
MultiplicativeSemigroup Rational Source # | |
MultiplicativeSemigroup Integer Source # | |
MultiplicativeSemigroup Bool Source # | |
Semigroup a => MultiplicativeSemigroup (Multiplicative a) Source # | |
Defined in PlutusTx.Numeric (*) :: 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 Rational Source # | |
Defined in PlutusTx.Ratio | |
MultiplicativeMonoid Integer Source # | |
Defined in PlutusTx.Numeric | |
MultiplicativeMonoid Bool Source # | |
Defined in PlutusTx.Numeric | |
Monoid a => MultiplicativeMonoid (Multiplicative a) Source # | |
Defined in PlutusTx.Numeric 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.
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.
Instances
Monoid a => MultiplicativeMonoid (Multiplicative a) Source # | |
Defined in PlutusTx.Numeric one :: Multiplicative a Source # | |
Semigroup a => MultiplicativeSemigroup (Multiplicative a) Source # | |
Defined in PlutusTx.Numeric (*) :: 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
MultiplicativeMonoid a => Monoid (Product a) Source # | |
AdditiveMonoid a => Monoid (Sum a) Source # | |
MultiplicativeSemigroup a => Semigroup (Product a) Source # | |
AdditiveSemigroup a => Semigroup (Sum a) Source # | |