ideas-math-types-1.1: Common types for mathematical domain reasoners

Maintainer bastiaan.heeren@ou.nl provisional portable (depends on ghc) None Haskell2010

Domain.Algebra.Field

Description

Synopsis

# Semi-ring

class SemiRing a where Source #

Minimal complete definition

Methods

(|+|) :: a -> a -> a infixl 6 Source #

zero :: a Source #

sum :: [a] -> a Source #

(|*|) :: a -> a -> a infixl 7 Source #

one :: a Source #

product :: [a] -> a Source #

Instances
 Source # Instance detailsDefined in Domain.Math.Expr.Data Methods(|+|) :: Expr -> Expr -> Expr Source #sum :: [Expr] -> Expr Source #(|*|) :: Expr -> Expr -> Expr Source #product :: [Expr] -> Expr Source # Num a => SemiRing (SafeNum a) Source # Instance detailsDefined in Domain.Algebra.Field Methods(|+|) :: SafeNum a -> SafeNum a -> SafeNum a Source #sum :: [SafeNum a] -> SafeNum a Source #(|*|) :: SafeNum a -> SafeNum a -> SafeNum a Source #product :: [SafeNum a] -> SafeNum a Source # (CoField a, Field a) => SemiRing (SmartField a) Source # Instance detailsDefined in Domain.Algebra.SmartGroup Methods(|+|) :: SmartField a -> SmartField a -> SmartField a Source #sum :: [SmartField a] -> SmartField a Source #(|*|) :: SmartField a -> SmartField a -> SmartField a Source #product :: [SmartField a] -> SmartField a Source #

# Ring

class SemiRing a => Ring a where Source #

Minimal complete definition

Nothing

Methods

plusInverse :: a -> a Source #

(|-|) :: a -> a -> a infixl 6 Source #

Instances
 Source # Instance detailsDefined in Domain.Math.Expr.Data Methods(|-|) :: Expr -> Expr -> Expr Source # Num a => Ring (SafeNum a) Source # Instance detailsDefined in Domain.Algebra.Field Methods(|-|) :: SafeNum a -> SafeNum a -> SafeNum a Source # (CoField a, Field a) => Ring (SmartField a) Source # Instance detailsDefined in Domain.Algebra.SmartGroup Methods(|-|) :: SmartField a -> SmartField a -> SmartField a Source #

# Field

class Ring a => Field a where Source #

Minimal complete definition

Nothing

Methods

timesInverse :: a -> a Source #

(|/|) :: a -> a -> a infixl 7 Source #

Instances
 Source # Instance detailsDefined in Domain.Math.Expr.Data Methods(|/|) :: Expr -> Expr -> Expr Source # (Eq a, Fractional a) => Field (SafeNum a) Source # Instance detailsDefined in Domain.Algebra.Field Methods(|/|) :: SafeNum a -> SafeNum a -> SafeNum a Source # (CoField a, Field a) => Field (SmartField a) Source # Instance detailsDefined in Domain.Algebra.SmartGroup Methods(|/|) :: SmartField a -> SmartField a -> SmartField a Source #

Constructors

Instances

# Datatype for safe numeric operators

data SafeNum a Source #

Instances
 Source # Instance detailsDefined in Domain.Algebra.Field Methods(>>=) :: SafeNum a -> (a -> SafeNum b) -> SafeNum b #(>>) :: SafeNum a -> SafeNum b -> SafeNum b #return :: a -> SafeNum a #fail :: String -> SafeNum a # Source # Instance detailsDefined in Domain.Algebra.Field Methodsfmap :: (a -> b) -> SafeNum a -> SafeNum b #(<\$) :: a -> SafeNum b -> SafeNum a # Source # Instance detailsDefined in Domain.Algebra.Field Methodspure :: a -> SafeNum a #(<*>) :: SafeNum (a -> b) -> SafeNum a -> SafeNum b #liftA2 :: (a -> b -> c) -> SafeNum a -> SafeNum b -> SafeNum c #(*>) :: SafeNum a -> SafeNum b -> SafeNum b #(<*) :: SafeNum a -> SafeNum b -> SafeNum a # Eq a => Eq (SafeNum a) Source # Instance detailsDefined in Domain.Algebra.Field Methods(==) :: SafeNum a -> SafeNum a -> Bool #(/=) :: SafeNum a -> SafeNum a -> Bool # (Eq a, Fractional a) => Fractional (SafeNum a) Source # Instance detailsDefined in Domain.Algebra.Field Methods(/) :: SafeNum a -> SafeNum a -> SafeNum a #recip :: SafeNum a -> SafeNum a # Num a => Num (SafeNum a) Source # Instance detailsDefined in Domain.Algebra.Field Methods(+) :: SafeNum a -> SafeNum a -> SafeNum a #(-) :: SafeNum a -> SafeNum a -> SafeNum a #(*) :: SafeNum a -> SafeNum a -> SafeNum a #negate :: SafeNum a -> SafeNum a #abs :: SafeNum a -> SafeNum a #signum :: SafeNum a -> SafeNum a # Ord a => Ord (SafeNum a) Source # Instance detailsDefined in Domain.Algebra.Field Methodscompare :: SafeNum a -> SafeNum a -> Ordering #(<) :: SafeNum a -> SafeNum a -> Bool #(<=) :: SafeNum a -> SafeNum a -> Bool #(>) :: SafeNum a -> SafeNum a -> Bool #(>=) :: SafeNum a -> SafeNum a -> Bool #max :: SafeNum a -> SafeNum a -> SafeNum a #min :: SafeNum a -> SafeNum a -> SafeNum a # Show a => Show (SafeNum a) Source # Instance detailsDefined in Domain.Algebra.Field MethodsshowsPrec :: Int -> SafeNum a -> ShowS #show :: SafeNum a -> String #showList :: [SafeNum a] -> ShowS # Arbitrary a => Arbitrary (SafeNum a) Source # Instance detailsDefined in Domain.Algebra.Field Methodsarbitrary :: Gen (SafeNum a) #shrink :: SafeNum a -> [SafeNum a] # (Eq a, Fractional a) => Field (SafeNum a) Source # Instance detailsDefined in Domain.Algebra.Field Methods(|/|) :: SafeNum a -> SafeNum a -> SafeNum a Source # Num a => Ring (SafeNum a) Source # Instance detailsDefined in Domain.Algebra.Field Methods(|-|) :: SafeNum a -> SafeNum a -> SafeNum a Source # Num a => SemiRing (SafeNum a) Source # Instance detailsDefined in Domain.Algebra.Field Methods(|+|) :: SafeNum a -> SafeNum a -> SafeNum a Source #sum :: [SafeNum a] -> SafeNum a Source #(|*|) :: SafeNum a -> SafeNum a -> SafeNum a Source #product :: [SafeNum a] -> SafeNum a Source #

# CoSemiRing, CoRing, and CoField (for matching)

class CoSemiRing a where Source #

Methods

isPlus :: a -> Maybe (a, a) Source #

isZero :: a -> Bool Source #

isTimes :: a -> Maybe (a, a) Source #

isOne :: a -> Bool Source #

Instances
 Source # Instance detailsDefined in Domain.Math.Expr.Data Methods Source # Instance detailsDefined in Domain.Algebra.SmartGroup Methods

class CoSemiRing a => CoRing a where Source #

Minimal complete definition

isNegate

Methods

isNegate :: a -> Maybe a Source #

isMinus :: a -> Maybe (a, a) Source #

Instances
 Source # Instance detailsDefined in Domain.Math.Expr.Data Methods CoRing a => CoRing (SmartField a) Source # Instance detailsDefined in Domain.Algebra.SmartGroup Methods

class CoRing a => CoField a where Source #

Minimal complete definition

isRecip

Methods

isRecip :: a -> Maybe a Source #

isDivision :: a -> Maybe (a, a) Source #

Instances
 Source # Instance detailsDefined in Domain.Math.Expr.Data Methods CoField a => CoField (SmartField a) Source # Instance detailsDefined in Domain.Algebra.SmartGroup Methods