semirings-0.3.1.1: two monoids as one, in holy haskimony

Data.Semiring

Description

A class for semirings (types with two binary operations, one commutative and one associative, and two respective identities), with various general-purpose instances.

Synopsis

# Semiring typeclass

class Semiring a where Source #

The class of semirings (types with two binary operations and two respective identities). One can think of a semiring as two monoids of the same underlying type, with the first being commutative. In the documentation, you will often see the first monoid being referred to as additive, and the second monoid being referred to as multiplicative, a typical convention when talking about semirings.

For any type R with a Num instance, the additive monoid is (R, '(Prelude.+)', 0) and the multiplicative monoid is (R, '(Prelude.*)', 1).

For Bool, the additive monoid is (Bool, ||, False) and the multiplicative monoid is (Bool, &&, True).

Instances should satisfy the following laws:

x + zero = zero + x = x
x + (y + z) = (x + y) + z
x + y = y + x
multiplicative identity
x * one = one * x = x
multiplicative associativity
x * (y * z) = (x * y) * z
left- and right-distributivity of * over +
x * (y + z) = (x * y) + (x * z) (x + y) * z = (x * z) + (y * z)
annihilation
zero * x = x * zero = zero

Methods

plus infixl 6 Source #

Arguments

 :: a -> a -> a Commutative Operation

Arguments

 :: a Commutative Unit

times infixl 7 Source #

Arguments

 :: a -> a -> a Associative Operation

Arguments

 :: a Associative Unit
Instances
Source #
Instance details

Defined in Data.Semiring

Methods

plus :: Bool -> Bool -> Bool Source #

times :: Bool -> Bool -> Bool Source #

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

plus :: Int -> Int -> Int Source #

times :: Int -> Int -> Int Source #

Source #
Instance details

Defined in Data.Semiring

Methods

plus :: Int8 -> Int8 -> Int8 Source #

times :: Int8 -> Int8 -> Int8 Source #

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

plus :: Word -> Word -> Word Source #

times :: Word -> Word -> Word Source #

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Semiring () Source #
Instance details

Defined in Data.Semiring

Methods

plus :: () -> () -> () Source #

zero :: () Source #

times :: () -> () -> () Source #

one :: () Source #

Source #
Instance details

Defined in Data.Semiring

Methods

plus :: CDev -> CDev -> CDev Source #

times :: CDev -> CDev -> CDev Source #

Source #
Instance details

Defined in Data.Semiring

Methods

plus :: CIno -> CIno -> CIno Source #

times :: CIno -> CIno -> CIno Source #

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

plus :: COff -> COff -> COff Source #

times :: COff -> COff -> COff Source #

Source #
Instance details

Defined in Data.Semiring

Methods

plus :: CPid -> CPid -> CPid Source #

times :: CPid -> CPid -> CPid Source #

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

plus :: CGid -> CGid -> CGid Source #

times :: CGid -> CGid -> CGid Source #

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

plus :: CUid -> CUid -> CUid Source #

times :: CUid -> CUid -> CUid Source #

Source #
Instance details

Defined in Data.Semiring

Methods

plus :: CCc -> CCc -> CCc Source #

times :: CCc -> CCc -> CCc Source #

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

plus :: Fd -> Fd -> Fd Source #

times :: Fd -> Fd -> Fd Source #

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

plus :: CInt -> CInt -> CInt Source #

times :: CInt -> CInt -> CInt Source #

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Source #
Instance details

Defined in Data.Semiring

Methods

Semiring a => Semiring [a] Source #

The Semiring instance for '[a]' can be interpreted as treating each element of the list as coefficients to a polynomial in one variable.

#### Examples

Expand

poly1 = [1,2,3] :: [Int] poly2 = [ 2,1] :: [Int] poly1 * poly2 = [2,5,8,3] fromList [2,5,8,3]

Instance details

Defined in Data.Semiring

Methods

plus :: [a] -> [a] -> [a] Source #

zero :: [a] Source #

times :: [a] -> [a] -> [a] Source #

one :: [a] Source #

Semiring a => Semiring (Maybe a) Source #
Instance details

Defined in Data.Semiring

Methods

plus :: Maybe a -> Maybe a -> Maybe a Source #

times :: Maybe a -> Maybe a -> Maybe a Source #

Integral a => Semiring (Ratio a) Source #
Instance details

Defined in Data.Semiring

Methods

plus :: Ratio a -> Ratio a -> Ratio a Source #

times :: Ratio a -> Ratio a -> Ratio a Source #

Semiring a => Semiring (IO a) Source #
Instance details

Defined in Data.Semiring

Methods

plus :: IO a -> IO a -> IO a Source #

times :: IO a -> IO a -> IO a Source #

one :: IO a Source #

Ring a => Semiring (Complex a) Source #

This instance can suffer due to floating point arithmetic.

Instance details

Defined in Data.Semiring

Methods

plus :: Complex a -> Complex a -> Complex a Source #

times :: Complex a -> Complex a -> Complex a Source #

HasResolution a => Semiring (Fixed a) Source #
Instance details

Defined in Data.Semiring

Methods

plus :: Fixed a -> Fixed a -> Fixed a Source #

times :: Fixed a -> Fixed a -> Fixed a Source #

Source #
Instance details

Defined in Data.Semiring

Semiring a => Semiring (Equivalence a) Source #
Instance details

Defined in Data.Semiring

Semiring a => Semiring (Identity a) Source #
Instance details

Defined in Data.Semiring

Semiring a => Semiring (Dual a) Source #
Instance details

Defined in Data.Semiring

Methods

plus :: Dual a -> Dual a -> Dual a Source #

times :: Dual a -> Dual a -> Dual a Source #

Semiring a => Semiring (Down a) Source #
Instance details

Defined in Data.Semiring

Methods

plus :: Down a -> Down a -> Down a Source #

times :: Down a -> Down a -> Down a Source #

(Ord a, Monoid a) => Semiring (Set a) Source #

The multiplication laws are satisfied for any underlying Monoid, so we require a Monoid constraint instead of a Semiring constraint since times can use the context of either.

Instance details

Defined in Data.Semiring

Methods

plus :: Set a -> Set a -> Set a Source #

times :: Set a -> Set a -> Set a Source #

(Eq a, Hashable a, Monoid a) => Semiring (HashSet a) Source #

The multiplication laws are satisfied for any underlying Monoid, so we require a Monoid constraint instead of a Semiring constraint since times can use the context of either.

Instance details

Defined in Data.Semiring

Methods

plus :: HashSet a -> HashSet a -> HashSet a Source #

times :: HashSet a -> HashSet a -> HashSet a Source #

(Unbox a, Semiring a) => Semiring (Vector a) Source #
Instance details

Defined in Data.Semiring

Methods

plus :: Vector a -> Vector a -> Vector a Source #

times :: Vector a -> Vector a -> Vector a Source #

(Storable a, Semiring a) => Semiring (Vector a) Source #
Instance details

Defined in Data.Semiring

Methods

plus :: Vector a -> Vector a -> Vector a Source #

times :: Vector a -> Vector a -> Vector a Source #

Semiring a => Semiring (Vector a) Source #

The Semiring instance for 'Vector a' can be interpreted as treating each element of the list as coefficients to a polynomial in one variable.

#### Examples

Expand

poly1 = Vector.fromList [1,2,3 :: Int] poly2 = Vector.fromList [ 2,1 :: Int] poly1 * poly2 fromList [2,5,8,3]

Instance details

Defined in Data.Semiring

Methods

plus :: Vector a -> Vector a -> Vector a Source #

times :: Vector a -> Vector a -> Vector a Source #

(Coercible Int a, Monoid a) => Semiring (IntSetOf a) Source #
Instance details

Defined in Data.Semiring

Num a => Semiring (WrappedNum a) Source #
Instance details

Defined in Data.Semiring

Source #
Instance details

Defined in Data.Semiring.Generic

Methods

Semiring b => Semiring (a -> b) Source #
Instance details

Defined in Data.Semiring

Methods

plus :: (a -> b) -> (a -> b) -> a -> b Source #

zero :: a -> b Source #

times :: (a -> b) -> (a -> b) -> a -> b Source #

one :: a -> b Source #

(Semiring a, Semiring b) => Semiring (a, b) Source #
Instance details

Defined in Data.Semiring.Generic

Methods

plus :: (a, b) -> (a, b) -> (a, b) Source #

zero :: (a, b) Source #

times :: (a, b) -> (a, b) -> (a, b) Source #

one :: (a, b) Source #

Semiring a => Semiring (Op a b) Source #
Instance details

Defined in Data.Semiring

Methods

plus :: Op a b -> Op a b -> Op a b Source #

zero :: Op a b Source #

times :: Op a b -> Op a b -> Op a b Source #

one :: Op a b Source #

Source #
Instance details

Defined in Data.Semiring

Methods

plus :: Proxy a -> Proxy a -> Proxy a Source #

times :: Proxy a -> Proxy a -> Proxy a Source #

(Ord k, Monoid k, Semiring v) => Semiring (Map k v) Source #

The multiplication laws are satisfied for any underlying Monoid as the key type, so we require a Monoid constraint instead of a Semiring constraint since times can use the context of either.

Instance details

Defined in Data.Semiring

Methods

plus :: Map k v -> Map k v -> Map k v Source #

zero :: Map k v Source #

times :: Map k v -> Map k v -> Map k v Source #

one :: Map k v Source #

(Eq k, Hashable k, Monoid k, Semiring v) => Semiring (HashMap k v) Source #

The multiplication laws are satisfied for any underlying Monoid as the key type, so we require a Monoid constraint instead of a Semiring constraint since times can use the context of either.

Instance details

Defined in Data.Semiring

Methods

plus :: HashMap k v -> HashMap k v -> HashMap k v Source #

zero :: HashMap k v Source #

times :: HashMap k v -> HashMap k v -> HashMap k v Source #

one :: HashMap k v Source #

(Coercible Int k, Monoid k, Semiring v) => Semiring (IntMapOf k v) Source #
Instance details

Defined in Data.Semiring

Methods

plus :: IntMapOf k v -> IntMapOf k v -> IntMapOf k v Source #

zero :: IntMapOf k v Source #

times :: IntMapOf k v -> IntMapOf k v -> IntMapOf k v Source #

one :: IntMapOf k v Source #

(Ord a, Monoid a, Extremum e) => Semiring (Tropical e a) Source #
Instance details

Defined in Data.Semiring.Tropical

Methods

plus :: Tropical e a -> Tropical e a -> Tropical e a Source #

zero :: Tropical e a Source #

times :: Tropical e a -> Tropical e a -> Tropical e a Source #

one :: Tropical e a Source #

(Semiring a, Semiring b, Semiring c) => Semiring (a, b, c) Source #
Instance details

Defined in Data.Semiring.Generic

Methods

plus :: (a, b, c) -> (a, b, c) -> (a, b, c) Source #

zero :: (a, b, c) Source #

times :: (a, b, c) -> (a, b, c) -> (a, b, c) Source #

one :: (a, b, c) Source #

Semiring a => Semiring (Const a b) Source #
Instance details

Defined in Data.Semiring

Methods

plus :: Const a b -> Const a b -> Const a b Source #

zero :: Const a b Source #

times :: Const a b -> Const a b -> Const a b Source #

one :: Const a b Source #

(Semiring a, Applicative f) => Semiring (Ap f a) Source #
Instance details

Defined in Data.Semiring

Methods

plus :: Ap f a -> Ap f a -> Ap f a Source #

zero :: Ap f a Source #

times :: Ap f a -> Ap f a -> Ap f a Source #

one :: Ap f a Source #

(Semiring a, Semiring b, Semiring c, Semiring d) => Semiring (a, b, c, d) Source #
Instance details

Defined in Data.Semiring.Generic

Methods

plus :: (a, b, c, d) -> (a, b, c, d) -> (a, b, c, d) Source #

zero :: (a, b, c, d) Source #

times :: (a, b, c, d) -> (a, b, c, d) -> (a, b, c, d) Source #

one :: (a, b, c, d) Source #

(Semiring a, Semiring b, Semiring c, Semiring d, Semiring e) => Semiring (a, b, c, d, e) Source #
Instance details

Defined in Data.Semiring.Generic

Methods

plus :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) Source #

zero :: (a, b, c, d, e) Source #

times :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) Source #

one :: (a, b, c, d, e) Source #

(Semiring a, Semiring b, Semiring c, Semiring d, Semiring e, Semiring f) => Semiring (a, b, c, d, e, f) Source #
Instance details

Defined in Data.Semiring.Generic

Methods

plus :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) Source #

zero :: (a, b, c, d, e, f) Source #

times :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) Source #

one :: (a, b, c, d, e, f) Source #

(Semiring a, Semiring b, Semiring c, Semiring d, Semiring e, Semiring f, Semiring g) => Semiring (a, b, c, d, e, f, g) Source #
Instance details

Defined in Data.Semiring.Generic

Methods

plus :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) Source #

zero :: (a, b, c, d, e, f, g) Source #

times :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) Source #

one :: (a, b, c, d, e, f, g) Source #

(+) :: Semiring a => a -> a -> a infixl 6 Source #

Infix shorthand for plus.

(*) :: Semiring a => a -> a -> a infixl 7 Source #

Infix shorthand for times.

(^) :: (Semiring a, Integral b) => a -> b -> a infixr 8 Source #

Raise a number to a non-negative integral power. If the power is negative, this will return zero.

foldMapP :: (Foldable t, Semiring s) => (a -> s) -> t a -> s Source #

Map each element of the structure to a semiring, and combine the results using plus.

foldMapT :: (Foldable t, Semiring s) => (a -> s) -> t a -> s Source #

Map each element of the structure to a semiring, and combine the results using times.

sum :: (Foldable t, Semiring a) => t a -> a Source #

The sum function computes the additive sum of the elements in a structure. This function is lazy. For a strict version, see sum'.

product :: (Foldable t, Semiring a) => t a -> a Source #

The product function computes the product of the elements in a structure. This function is lazy. for a strict version, see product'.

sum' :: (Foldable t, Semiring a) => t a -> a Source #

The sum' function computes the additive sum of the elements in a structure. This function is strict. For a lazy version, see sum.

product' :: (Foldable t, Semiring a) => t a -> a Source #

The product' function computes the additive sum of the elements in a structure. This function is strict. For a lazy version, see product.

# Types

Monoid under plus. Analogous to Sum, but uses the Semiring constraint rather than Num.

Constructors

Instances
 Source # Instance detailsDefined in Data.Semiring Methodsfmap :: (a -> b) -> Add a -> Add b #(<) :: a -> Add b -> Add a # Source # Instance detailsDefined in Data.Semiring Methodsfold :: Monoid m => Add m -> m #foldMap :: Monoid m => (a -> m) -> Add a -> m #foldr :: (a -> b -> b) -> b -> Add a -> b #foldr' :: (a -> b -> b) -> b -> Add a -> b #foldl :: (b -> a -> b) -> b -> Add a -> b #foldl' :: (b -> a -> b) -> b -> Add a -> b #foldr1 :: (a -> a -> a) -> Add a -> a #foldl1 :: (a -> a -> a) -> Add a -> a #toList :: Add a -> [a] #null :: Add a -> Bool #length :: Add a -> Int #elem :: Eq a => a -> Add a -> Bool #maximum :: Ord a => Add a -> a #minimum :: Ord a => Add a -> a #sum :: Num a => Add a -> a #product :: Num a => Add a -> a # Source # Instance detailsDefined in Data.Semiring Methodstraverse :: Applicative f => (a -> f b) -> Add a -> f (Add b) #sequenceA :: Applicative f => Add (f a) -> f (Add a) #mapM :: Monad m => (a -> m b) -> Add a -> m (Add b) #sequence :: Monad m => Add (m a) -> m (Add a) # Bounded a => Bounded (Add a) Source # Instance detailsDefined in Data.Semiring MethodsminBound :: Add a #maxBound :: Add a # Enum a => Enum (Add a) Source # Instance detailsDefined in Data.Semiring Methodssucc :: Add a -> Add a #pred :: Add a -> Add a #toEnum :: Int -> Add a #fromEnum :: Add a -> Int #enumFrom :: Add a -> [Add a] #enumFromThen :: Add a -> Add a -> [Add a] #enumFromTo :: Add a -> Add a -> [Add a] #enumFromThenTo :: Add a -> Add a -> Add a -> [Add a] # Eq a => Eq (Add a) Source # Instance detailsDefined in Data.Semiring Methods(==) :: Add a -> Add a -> Bool #(/=) :: Add a -> Add a -> Bool # Fractional a => Fractional (Add a) Source # Instance detailsDefined in Data.Semiring Methods(/) :: Add a -> Add a -> Add a #recip :: Add a -> Add a # Num a => Num (Add a) Source # Instance detailsDefined in Data.Semiring Methods(+) :: Add a -> Add a -> Add a #(-) :: Add a -> Add a -> Add a #(*) :: Add a -> Add a -> Add a #negate :: Add a -> Add a #abs :: Add a -> Add a #signum :: Add a -> Add a # Ord a => Ord (Add a) Source # Instance detailsDefined in Data.Semiring Methodscompare :: Add a -> Add a -> Ordering #(<) :: Add a -> Add a -> Bool #(<=) :: Add a -> Add a -> Bool #(>) :: Add a -> Add a -> Bool #(>=) :: Add a -> Add a -> Bool #max :: Add a -> Add a -> Add a #min :: Add a -> Add a -> Add a # Read a => Read (Add a) Source # Instance detailsDefined in Data.Semiring MethodsreadsPrec :: Int -> ReadS (Add a) #readList :: ReadS [Add a] #readPrec :: ReadPrec (Add a) # Real a => Real (Add a) Source # Instance detailsDefined in Data.Semiring MethodstoRational :: Add a -> Rational # RealFrac a => RealFrac (Add a) Source # Instance detailsDefined in Data.Semiring MethodsproperFraction :: Integral b => Add a -> (b, Add a) #truncate :: Integral b => Add a -> b #round :: Integral b => Add a -> b #ceiling :: Integral b => Add a -> b #floor :: Integral b => Add a -> b # Show a => Show (Add a) Source # Instance detailsDefined in Data.Semiring MethodsshowsPrec :: Int -> Add a -> ShowS #show :: Add a -> String #showList :: [Add a] -> ShowS # Generic (Add a) Source # Instance detailsDefined in Data.Semiring Associated Typestype Rep (Add a) :: Type -> Type # Methodsfrom :: Add a -> Rep (Add a) x #to :: Rep (Add a) x -> Add a # Semiring a => Semigroup (Add a) Source # Instance detailsDefined in Data.Semiring Methods(<>) :: Add a -> Add a -> Add a #sconcat :: NonEmpty (Add a) -> Add a #stimes :: Integral b => b -> Add a -> Add a # Semiring a => Monoid (Add a) Source # Instance detailsDefined in Data.Semiring Methodsmempty :: Add a #mappend :: Add a -> Add a -> Add a #mconcat :: [Add a] -> Add a # Storable a => Storable (Add a) Source # Instance detailsDefined in Data.Semiring MethodssizeOf :: Add a -> Int #alignment :: Add a -> Int #peekElemOff :: Ptr (Add a) -> Int -> IO (Add a) #pokeElemOff :: Ptr (Add a) -> Int -> Add a -> IO () #peekByteOff :: Ptr b -> Int -> IO (Add a) #pokeByteOff :: Ptr b -> Int -> Add a -> IO () #peek :: Ptr (Add a) -> IO (Add a) #poke :: Ptr (Add a) -> Add a -> IO () # Source # Instance detailsDefined in Data.Semiring Associated Typestype Rep1 Add :: k -> Type # Methodsfrom1 :: Add a -> Rep1 Add a #to1 :: Rep1 Add a -> Add a # type Rep (Add a) Source # Instance detailsDefined in Data.Semiring type Rep (Add a) = D1 (MetaData "Add" "Data.Semiring" "semirings-0.3.1.1-2ZJ3nDBOXjQJGfuk3pcBdp" True) (C1 (MetaCons "Add" PrefixI True) (S1 (MetaSel (Just "getAdd") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a))) type Rep1 Add Source # Instance detailsDefined in Data.Semiring type Rep1 Add = D1 (MetaData "Add" "Data.Semiring" "semirings-0.3.1.1-2ZJ3nDBOXjQJGfuk3pcBdp" True) (C1 (MetaCons "Add" PrefixI True) (S1 (MetaSel (Just "getAdd") NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1)) newtype Mul a Source # Monoid under times. Analogous to Product, but uses the Semiring constraint rather than Num. Constructors  Mul FieldsgetMul :: a Instances  Source # Instance detailsDefined in Data.Semiring Methodsfmap :: (a -> b) -> Mul a -> Mul b #(<) :: a -> Mul b -> Mul a # Source # Instance detailsDefined in Data.Semiring Methodsfold :: Monoid m => Mul m -> m #foldMap :: Monoid m => (a -> m) -> Mul a -> m #foldr :: (a -> b -> b) -> b -> Mul a -> b #foldr' :: (a -> b -> b) -> b -> Mul a -> b #foldl :: (b -> a -> b) -> b -> Mul a -> b #foldl' :: (b -> a -> b) -> b -> Mul a -> b #foldr1 :: (a -> a -> a) -> Mul a -> a #foldl1 :: (a -> a -> a) -> Mul a -> a #toList :: Mul a -> [a] #null :: Mul a -> Bool #length :: Mul a -> Int #elem :: Eq a => a -> Mul a -> Bool #maximum :: Ord a => Mul a -> a #minimum :: Ord a => Mul a -> a #sum :: Num a => Mul a -> a #product :: Num a => Mul a -> a # Source # Instance detailsDefined in Data.Semiring Methodstraverse :: Applicative f => (a -> f b) -> Mul a -> f (Mul b) #sequenceA :: Applicative f => Mul (f a) -> f (Mul a) #mapM :: Monad m => (a -> m b) -> Mul a -> m (Mul b) #sequence :: Monad m => Mul (m a) -> m (Mul a) # Bounded a => Bounded (Mul a) Source # Instance detailsDefined in Data.Semiring MethodsminBound :: Mul a #maxBound :: Mul a # Enum a => Enum (Mul a) Source # Instance detailsDefined in Data.Semiring Methodssucc :: Mul a -> Mul a #pred :: Mul a -> Mul a #toEnum :: Int -> Mul a #fromEnum :: Mul a -> Int #enumFrom :: Mul a -> [Mul a] #enumFromThen :: Mul a -> Mul a -> [Mul a] #enumFromTo :: Mul a -> Mul a -> [Mul a] #enumFromThenTo :: Mul a -> Mul a -> Mul a -> [Mul a] # Eq a => Eq (Mul a) Source # Instance detailsDefined in Data.Semiring Methods(==) :: Mul a -> Mul a -> Bool #(/=) :: Mul a -> Mul a -> Bool # Fractional a => Fractional (Mul a) Source # Instance detailsDefined in Data.Semiring Methods(/) :: Mul a -> Mul a -> Mul a #recip :: Mul a -> Mul a # Num a => Num (Mul a) Source # Instance detailsDefined in Data.Semiring Methods(+) :: Mul a -> Mul a -> Mul a #(-) :: Mul a -> Mul a -> Mul a #(*) :: Mul a -> Mul a -> Mul a #negate :: Mul a -> Mul a #abs :: Mul a -> Mul a #signum :: Mul a -> Mul a # Ord a => Ord (Mul a) Source # Instance detailsDefined in Data.Semiring Methodscompare :: Mul a -> Mul a -> Ordering #(<) :: Mul a -> Mul a -> Bool #(<=) :: Mul a -> Mul a -> Bool #(>) :: Mul a -> Mul a -> Bool #(>=) :: Mul a -> Mul a -> Bool #max :: Mul a -> Mul a -> Mul a #min :: Mul a -> Mul a -> Mul a # Read a => Read (Mul a) Source # Instance detailsDefined in Data.Semiring MethodsreadsPrec :: Int -> ReadS (Mul a) #readList :: ReadS [Mul a] #readPrec :: ReadPrec (Mul a) # Real a => Real (Mul a) Source # Instance detailsDefined in Data.Semiring MethodstoRational :: Mul a -> Rational # RealFrac a => RealFrac (Mul a) Source # Instance detailsDefined in Data.Semiring MethodsproperFraction :: Integral b => Mul a -> (b, Mul a) #truncate :: Integral b => Mul a -> b #round :: Integral b => Mul a -> b #ceiling :: Integral b => Mul a -> b #floor :: Integral b => Mul a -> b # Show a => Show (Mul a) Source # Instance detailsDefined in Data.Semiring MethodsshowsPrec :: Int -> Mul a -> ShowS #show :: Mul a -> String #showList :: [Mul a] -> ShowS # Generic (Mul a) Source # Instance detailsDefined in Data.Semiring Associated Typestype Rep (Mul a) :: Type -> Type # Methodsfrom :: Mul a -> Rep (Mul a) x #to :: Rep (Mul a) x -> Mul a # Semiring a => Semigroup (Mul a) Source # Instance detailsDefined in Data.Semiring Methods(<>) :: Mul a -> Mul a -> Mul a #sconcat :: NonEmpty (Mul a) -> Mul a #stimes :: Integral b => b -> Mul a -> Mul a # Semiring a => Monoid (Mul a) Source # Instance detailsDefined in Data.Semiring Methodsmempty :: Mul a #mappend :: Mul a -> Mul a -> Mul a #mconcat :: [Mul a] -> Mul a # Storable a => Storable (Mul a) Source # Instance detailsDefined in Data.Semiring MethodssizeOf :: Mul a -> Int #alignment :: Mul a -> Int #peekElemOff :: Ptr (Mul a) -> Int -> IO (Mul a) #pokeElemOff :: Ptr (Mul a) -> Int -> Mul a -> IO () #peekByteOff :: Ptr b -> Int -> IO (Mul a) #pokeByteOff :: Ptr b -> Int -> Mul a -> IO () #peek :: Ptr (Mul a) -> IO (Mul a) #poke :: Ptr (Mul a) -> Mul a -> IO () # Source # Instance detailsDefined in Data.Semiring Associated Typestype Rep1 Mul :: k -> Type # Methodsfrom1 :: Mul a -> Rep1 Mul a #to1 :: Rep1 Mul a -> Mul a # type Rep (Mul a) Source # Instance detailsDefined in Data.Semiring type Rep (Mul a) = D1 (MetaData "Mul" "Data.Semiring" "semirings-0.3.1.1-2ZJ3nDBOXjQJGfuk3pcBdp" True) (C1 (MetaCons "Mul" PrefixI True) (S1 (MetaSel (Just "getMul") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a))) type Rep1 Mul Source # Instance detailsDefined in Data.Semiring type Rep1 Mul = D1 (MetaData "Mul" "Data.Semiring" "semirings-0.3.1.1-2ZJ3nDBOXjQJGfuk3pcBdp" True) (C1 (MetaCons "Mul" PrefixI True) (S1 (MetaSel (Just "getMul") NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1))

newtype WrappedNum a Source #

Provide Semiring and Ring for an arbitrary Num. It is useful with GHC 8.6+'s DerivingVia extension.

Constructors

 WrapNum FieldsunwrapNum :: a
Instances
 Source # Instance detailsDefined in Data.Semiring Methodsfmap :: (a -> b) -> WrappedNum a -> WrappedNum b #(<\$) :: a -> WrappedNum b -> WrappedNum a # Source # Instance detailsDefined in Data.Semiring Methodsfold :: Monoid m => WrappedNum m -> m #foldMap :: Monoid m => (a -> m) -> WrappedNum a -> m #foldr :: (a -> b -> b) -> b -> WrappedNum a -> b #foldr' :: (a -> b -> b) -> b -> WrappedNum a -> b #foldl :: (b -> a -> b) -> b -> WrappedNum a -> b #foldl' :: (b -> a -> b) -> b -> WrappedNum a -> b #foldr1 :: (a -> a -> a) -> WrappedNum a -> a #foldl1 :: (a -> a -> a) -> WrappedNum a -> a #toList :: WrappedNum a -> [a] #null :: WrappedNum a -> Bool #length :: WrappedNum a -> Int #elem :: Eq a => a -> WrappedNum a -> Bool #maximum :: Ord a => WrappedNum a -> a #minimum :: Ord a => WrappedNum a -> a #sum :: Num a => WrappedNum a -> a #product :: Num a => WrappedNum a -> a # Source # Instance detailsDefined in Data.Semiring Methodstraverse :: Applicative f => (a -> f b) -> WrappedNum a -> f (WrappedNum b) #sequenceA :: Applicative f => WrappedNum (f a) -> f (WrappedNum a) #mapM :: Monad m => (a -> m b) -> WrappedNum a -> m (WrappedNum b) #sequence :: Monad m => WrappedNum (m a) -> m (WrappedNum a) # Bounded a => Bounded (WrappedNum a) Source # Instance detailsDefined in Data.Semiring Methods Enum a => Enum (WrappedNum a) Source # Instance detailsDefined in Data.Semiring Methodssucc :: WrappedNum a -> WrappedNum a #pred :: WrappedNum a -> WrappedNum a #toEnum :: Int -> WrappedNum a #fromEnum :: WrappedNum a -> Int #enumFrom :: WrappedNum a -> [WrappedNum a] #enumFromThen :: WrappedNum a -> WrappedNum a -> [WrappedNum a] #enumFromTo :: WrappedNum a -> WrappedNum a -> [WrappedNum a] #enumFromThenTo :: WrappedNum a -> WrappedNum a -> WrappedNum a -> [WrappedNum a] # Eq a => Eq (WrappedNum a) Source # Instance detailsDefined in Data.Semiring Methods(==) :: WrappedNum a -> WrappedNum a -> Bool #(/=) :: WrappedNum a -> WrappedNum a -> Bool # Source # Instance detailsDefined in Data.Semiring Methods(/) :: WrappedNum a -> WrappedNum a -> WrappedNum a #recip :: WrappedNum a -> WrappedNum a # Num a => Num (WrappedNum a) Source # Instance detailsDefined in Data.Semiring Methods(+) :: WrappedNum a -> WrappedNum a -> WrappedNum a #(-) :: WrappedNum a -> WrappedNum a -> WrappedNum a #(*) :: WrappedNum a -> WrappedNum a -> WrappedNum a #negate :: WrappedNum a -> WrappedNum a #abs :: WrappedNum a -> WrappedNum a #signum :: WrappedNum a -> WrappedNum a # Ord a => Ord (WrappedNum a) Source # Instance detailsDefined in Data.Semiring Methodscompare :: WrappedNum a -> WrappedNum a -> Ordering #(<) :: WrappedNum a -> WrappedNum a -> Bool #(<=) :: WrappedNum a -> WrappedNum a -> Bool #(>) :: WrappedNum a -> WrappedNum a -> Bool #(>=) :: WrappedNum a -> WrappedNum a -> Bool #max :: WrappedNum a -> WrappedNum a -> WrappedNum a #min :: WrappedNum a -> WrappedNum a -> WrappedNum a # Read a => Read (WrappedNum a) Source # Instance detailsDefined in Data.Semiring MethodsreadsPrec :: Int -> ReadS (WrappedNum a) # Real a => Real (WrappedNum a) Source # Instance detailsDefined in Data.Semiring Methods RealFrac a => RealFrac (WrappedNum a) Source # Instance detailsDefined in Data.Semiring MethodsproperFraction :: Integral b => WrappedNum a -> (b, WrappedNum a) #truncate :: Integral b => WrappedNum a -> b #round :: Integral b => WrappedNum a -> b #ceiling :: Integral b => WrappedNum a -> b #floor :: Integral b => WrappedNum a -> b # Show a => Show (WrappedNum a) Source # Instance detailsDefined in Data.Semiring MethodsshowsPrec :: Int -> WrappedNum a -> ShowS #show :: WrappedNum a -> String #showList :: [WrappedNum a] -> ShowS # Source # Instance detailsDefined in Data.Semiring Associated Typestype Rep (WrappedNum a) :: Type -> Type # Methodsfrom :: WrappedNum a -> Rep (WrappedNum a) x #to :: Rep (WrappedNum a) x -> WrappedNum a # Storable a => Storable (WrappedNum a) Source # Instance detailsDefined in Data.Semiring MethodssizeOf :: WrappedNum a -> Int #alignment :: WrappedNum a -> Int #peekElemOff :: Ptr (WrappedNum a) -> Int -> IO (WrappedNum a) #pokeElemOff :: Ptr (WrappedNum a) -> Int -> WrappedNum a -> IO () #peekByteOff :: Ptr b -> Int -> IO (WrappedNum a) #pokeByteOff :: Ptr b -> Int -> WrappedNum a -> IO () #peek :: Ptr (WrappedNum a) -> IO (WrappedNum a) #poke :: Ptr (WrappedNum a) -> WrappedNum a -> IO () # Num a => Ring (WrappedNum a) Source # Instance detailsDefined in Data.Semiring Methods Num a => Semiring (WrappedNum a) Source # Instance detailsDefined in Data.Semiring Methodsplus :: WrappedNum a -> WrappedNum a -> WrappedNum a Source #times :: WrappedNum a -> WrappedNum a -> WrappedNum a Source # Source # Instance detailsDefined in Data.Semiring Associated Typestype Rep1 WrappedNum :: k -> Type # Methodsto1 :: Rep1 WrappedNum a -> WrappedNum a # type Rep (WrappedNum a) Source # Instance detailsDefined in Data.Semiring type Rep (WrappedNum a) = D1 (MetaData "WrappedNum" "Data.Semiring" "semirings-0.3.1.1-2ZJ3nDBOXjQJGfuk3pcBdp" True) (C1 (MetaCons "WrapNum" PrefixI True) (S1 (MetaSel (Just "unwrapNum") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a))) type Rep1 WrappedNum Source # Instance detailsDefined in Data.Semiring type Rep1 WrappedNum = D1 (MetaData "WrappedNum" "Data.Semiring" "semirings-0.3.1.1-2ZJ3nDBOXjQJGfuk3pcBdp" True) (C1 (MetaCons "WrapNum" PrefixI True) (S1 (MetaSel (Just "unwrapNum") NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1))

newtype IntSetOf a Source #

Wrapper to mimic Set (Sum Int), Set (Product Int), etc., while having a more efficient underlying representation.

Constructors

 IntSetOf FieldsgetIntSet :: IntSet
Instances
 Eq (IntSetOf a) Source # Instance detailsDefined in Data.Semiring Methods(==) :: IntSetOf a -> IntSetOf a -> Bool #(/=) :: IntSetOf a -> IntSetOf a -> Bool # Ord (IntSetOf a) Source # Instance detailsDefined in Data.Semiring Methodscompare :: IntSetOf a -> IntSetOf a -> Ordering #(<) :: IntSetOf a -> IntSetOf a -> Bool #(<=) :: IntSetOf a -> IntSetOf a -> Bool #(>) :: IntSetOf a -> IntSetOf a -> Bool #(>=) :: IntSetOf a -> IntSetOf a -> Bool #max :: IntSetOf a -> IntSetOf a -> IntSetOf a #min :: IntSetOf a -> IntSetOf a -> IntSetOf a # Read (IntSetOf a) Source # Instance detailsDefined in Data.Semiring MethodsreadsPrec :: Int -> ReadS (IntSetOf a) # Show (IntSetOf a) Source # Instance detailsDefined in Data.Semiring MethodsshowsPrec :: Int -> IntSetOf a -> ShowS #show :: IntSetOf a -> String #showList :: [IntSetOf a] -> ShowS # Source # Instance detailsDefined in Data.Semiring Associated Typestype Rep (IntSetOf a) :: Type -> Type # Methodsfrom :: IntSetOf a -> Rep (IntSetOf a) x #to :: Rep (IntSetOf a) x -> IntSetOf a # Source # Instance detailsDefined in Data.Semiring Methods(<>) :: IntSetOf a -> IntSetOf a -> IntSetOf a #sconcat :: NonEmpty (IntSetOf a) -> IntSetOf a #stimes :: Integral b => b -> IntSetOf a -> IntSetOf a # Source # Instance detailsDefined in Data.Semiring Methodsmappend :: IntSetOf a -> IntSetOf a -> IntSetOf a #mconcat :: [IntSetOf a] -> IntSetOf a # (Coercible Int a, Monoid a) => Semiring (IntSetOf a) Source # Instance detailsDefined in Data.Semiring Methodsplus :: IntSetOf a -> IntSetOf a -> IntSetOf a Source #times :: IntSetOf a -> IntSetOf a -> IntSetOf a Source # Source # Instance detailsDefined in Data.Semiring Associated Typestype Rep1 IntSetOf :: k -> Type # Methodsfrom1 :: IntSetOf a -> Rep1 IntSetOf a #to1 :: Rep1 IntSetOf a -> IntSetOf a # type Rep (IntSetOf a) Source # Instance detailsDefined in Data.Semiring type Rep (IntSetOf a) = D1 (MetaData "IntSetOf" "Data.Semiring" "semirings-0.3.1.1-2ZJ3nDBOXjQJGfuk3pcBdp" True) (C1 (MetaCons "IntSetOf" PrefixI True) (S1 (MetaSel (Just "getIntSet") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 IntSet))) type Rep1 IntSetOf Source # Instance detailsDefined in Data.Semiring type Rep1 IntSetOf = D1 (MetaData "IntSetOf" "Data.Semiring" "semirings-0.3.1.1-2ZJ3nDBOXjQJGfuk3pcBdp" True) (C1 (MetaCons "IntSetOf" PrefixI True) (S1 (MetaSel (Just "getIntSet") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 IntSet)))

newtype IntMapOf k v Source #

Wrapper to mimic Map (Sum Int) v, Map (Product Int) v, etc., while having a more efficient underlying representation.

Constructors

 IntMapOf FieldsgetIntMap :: IntMap v
Instances
 Generic1 (IntMapOf k :: Type -> Type) Source # Instance detailsDefined in Data.Semiring Associated Typestype Rep1 (IntMapOf k) :: k -> Type # Methodsfrom1 :: IntMapOf k a -> Rep1 (IntMapOf k) a #to1 :: Rep1 (IntMapOf k) a -> IntMapOf k a # Eq v => Eq (IntMapOf k v) Source # Instance detailsDefined in Data.Semiring Methods(==) :: IntMapOf k v -> IntMapOf k v -> Bool #(/=) :: IntMapOf k v -> IntMapOf k v -> Bool # Ord v => Ord (IntMapOf k v) Source # Instance detailsDefined in Data.Semiring Methodscompare :: IntMapOf k v -> IntMapOf k v -> Ordering #(<) :: IntMapOf k v -> IntMapOf k v -> Bool #(<=) :: IntMapOf k v -> IntMapOf k v -> Bool #(>) :: IntMapOf k v -> IntMapOf k v -> Bool #(>=) :: IntMapOf k v -> IntMapOf k v -> Bool #max :: IntMapOf k v -> IntMapOf k v -> IntMapOf k v #min :: IntMapOf k v -> IntMapOf k v -> IntMapOf k v # Read v => Read (IntMapOf k v) Source # Instance detailsDefined in Data.Semiring MethodsreadsPrec :: Int -> ReadS (IntMapOf k v) #readList :: ReadS [IntMapOf k v] #readPrec :: ReadPrec (IntMapOf k v) # Show v => Show (IntMapOf k v) Source # Instance detailsDefined in Data.Semiring MethodsshowsPrec :: Int -> IntMapOf k v -> ShowS #show :: IntMapOf k v -> String #showList :: [IntMapOf k v] -> ShowS # Generic (IntMapOf k v) Source # Instance detailsDefined in Data.Semiring Associated Typestype Rep (IntMapOf k v) :: Type -> Type # Methodsfrom :: IntMapOf k v -> Rep (IntMapOf k v) x #to :: Rep (IntMapOf k v) x -> IntMapOf k v # Semigroup (IntMapOf k v) Source # Instance detailsDefined in Data.Semiring Methods(<>) :: IntMapOf k v -> IntMapOf k v -> IntMapOf k v #sconcat :: NonEmpty (IntMapOf k v) -> IntMapOf k v #stimes :: Integral b => b -> IntMapOf k v -> IntMapOf k v # Monoid (IntMapOf k v) Source # Instance detailsDefined in Data.Semiring Methodsmempty :: IntMapOf k v #mappend :: IntMapOf k v -> IntMapOf k v -> IntMapOf k v #mconcat :: [IntMapOf k v] -> IntMapOf k v # (Coercible Int k, Monoid k, Semiring v) => Semiring (IntMapOf k v) Source # Instance detailsDefined in Data.Semiring Methodsplus :: IntMapOf k v -> IntMapOf k v -> IntMapOf k v Source #zero :: IntMapOf k v Source #times :: IntMapOf k v -> IntMapOf k v -> IntMapOf k v Source #one :: IntMapOf k v Source # type Rep1 (IntMapOf k :: Type -> Type) Source # Instance detailsDefined in Data.Semiring type Rep1 (IntMapOf k :: Type -> Type) = D1 (MetaData "IntMapOf" "Data.Semiring" "semirings-0.3.1.1-2ZJ3nDBOXjQJGfuk3pcBdp" True) (C1 (MetaCons "IntMapOf" PrefixI True) (S1 (MetaSel (Just "getIntMap") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 IntMap))) type Rep (IntMapOf k v) Source # Instance detailsDefined in Data.Semiring type Rep (IntMapOf k v) = D1 (MetaData "IntMapOf" "Data.Semiring" "semirings-0.3.1.1-2ZJ3nDBOXjQJGfuk3pcBdp" True) (C1 (MetaCons "IntMapOf" PrefixI True) (S1 (MetaSel (Just "getIntMap") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (IntMap v))))

# Ring typeclass

class Semiring a => Ring a where Source #

The class of semirings with an additive inverse.

negate a + a = zero

Methods

negate :: a -> a Source #

Instances
 Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Ring () Source # Instance detailsDefined in Data.Semiring Methodsnegate :: () -> () Source # Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Source # Instance detailsDefined in Data.Semiring Methods Ring a => Ring [a] Source # Instance detailsDefined in Data.Semiring Methodsnegate :: [a] -> [a] Source # Ring a => Ring (Maybe a) Source # Instance detailsDefined in Data.Semiring Methodsnegate :: Maybe a -> Maybe a Source # Integral a => Ring (Ratio a) Source # Instance detailsDefined in Data.Semiring Methodsnegate :: Ratio a -> Ratio a Source # Ring a => Ring (IO a) Source # Instance detailsDefined in Data.Semiring Methodsnegate :: IO a -> IO a Source # Ring a => Ring (Complex a) Source # Instance detailsDefined in Data.Semiring Methodsnegate :: Complex a -> Complex a Source # HasResolution a => Ring (Fixed a) Source # Instance detailsDefined in Data.Semiring Methodsnegate :: Fixed a -> Fixed a Source # Source # Instance detailsDefined in Data.Semiring Methods Ring a => Ring (Equivalence a) Source # Instance detailsDefined in Data.Semiring Methods Ring a => Ring (Identity a) Source # Instance detailsDefined in Data.Semiring Methods Ring a => Ring (Dual a) Source # Instance detailsDefined in Data.Semiring Methodsnegate :: Dual a -> Dual a Source # Ring a => Ring (Down a) Source # Instance detailsDefined in Data.Semiring Methodsnegate :: Down a -> Down a Source # (Unbox a, Ring a) => Ring (Vector a) Source # Instance detailsDefined in Data.Semiring Methodsnegate :: Vector a -> Vector a Source # (Storable a, Ring a) => Ring (Vector a) Source # Instance detailsDefined in Data.Semiring Methodsnegate :: Vector a -> Vector a Source # Ring a => Ring (Vector a) Source # Instance detailsDefined in Data.Semiring Methodsnegate :: Vector a -> Vector a Source # Num a => Ring (WrappedNum a) Source # Instance detailsDefined in Data.Semiring Methods Ring b => Ring (a -> b) Source # Instance detailsDefined in Data.Semiring Methodsnegate :: (a -> b) -> a -> b Source # (Ring a, Ring b) => Ring (a, b) Source # Instance detailsDefined in Data.Semiring.Generic Methodsnegate :: (a, b) -> (a, b) Source # Ring a => Ring (Op a b) Source # Instance detailsDefined in Data.Semiring Methodsnegate :: Op a b -> Op a b Source # (Ring a, Ring b, Ring c) => Ring (a, b, c) Source # Instance detailsDefined in Data.Semiring.Generic Methodsnegate :: (a, b, c) -> (a, b, c) Source # Ring a => Ring (Const a b) Source # Instance detailsDefined in Data.Semiring Methodsnegate :: Const a b -> Const a b Source # (Ring a, Applicative f) => Ring (Ap f a) Source # Instance detailsDefined in Data.Semiring Methodsnegate :: Ap f a -> Ap f a Source # (Ring a, Ring b, Ring c, Ring d) => Ring (a, b, c, d) Source # Instance detailsDefined in Data.Semiring.Generic Methodsnegate :: (a, b, c, d) -> (a, b, c, d) Source # (Ring a, Ring b, Ring c, Ring d, Ring e) => Ring (a, b, c, d, e) Source # Instance detailsDefined in Data.Semiring.Generic Methodsnegate :: (a, b, c, d, e) -> (a, b, c, d, e) Source # (Ring a, Ring b, Ring c, Ring d, Ring e, Ring f) => Ring (a, b, c, d, e, f) Source # Instance detailsDefined in Data.Semiring.Generic Methodsnegate :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) Source # (Ring a, Ring b, Ring c, Ring d, Ring e, Ring f, Ring g) => Ring (a, b, c, d, e, f, g) Source # Instance detailsDefined in Data.Semiring.Generic Methodsnegate :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) Source #

(-) :: Ring a => a -> a -> a infixl 6 Source #

Infix shorthand for minus.

minus :: Ring a => a -> a -> a infixl 6 Source #

Subtract two Ring values. For any type R with a Num instance, this is the same as '(Prelude.-)'.

x minus y = x + negate y