ideas-1.3.1: Feedback services for intelligent tutoring systems

Maintainerbastiaan.heeren@ou.nl
Stabilityprovisional
Portabilityportable (depends on ghc)
Safe HaskellNone
LanguageHaskell98

Ideas.Common.Algebra.Field

Contents

Description

 

Synopsis

Semi-ring

class SemiRing a where Source

Minimal complete definition

(<+>), zero, (<*>), one

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

Num a => SemiRing (SafeNum a) 
(CoField a, Field a) => SemiRing (SmartField a) 

Ring

class SemiRing a => Ring a where Source

Minimal complete definition

Nothing

Methods

plusInverse :: a -> a Source

(<->) :: a -> a -> a infixl 6 Source

Instances

Num a => Ring (SafeNum a) 
(CoField a, Field a) => Ring (SmartField a) 

Field

class Ring a => Field a where Source

Minimal complete definition

Nothing

Methods

timesInverse :: a -> a Source

(</>) :: a -> a -> a infixl 7 Source

Instances

(Eq a, Fractional a) => Field (SafeNum a) 
(CoField a, Field a) => Field (SmartField a) 

Additive monoid

newtype Additive a Source

Constructors

Additive 

Fields

fromAdditive :: a
 

Multiplicative monoid

Datatype for safe numeric operators

data SafeNum a Source

Instances

Monad SafeNum 
Functor SafeNum 
Eq a => Eq (SafeNum a) 
(Eq a, Fractional a) => Fractional (SafeNum a) 
Num a => Num (SafeNum a) 
Ord a => Ord (SafeNum a) 
Show a => Show (SafeNum a) 
Arbitrary a => Arbitrary (SafeNum a) 
(Eq a, Fractional a) => Field (SafeNum a) 
Num a => Ring (SafeNum a) 
Num a => SemiRing (SafeNum a) 

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

class CoSemiRing a => CoRing a where Source

Minimal complete definition

isNegate

Methods

isNegate :: a -> Maybe a Source

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

Instances

class CoRing a => CoField a where Source

Minimal complete definition

isRecip

Methods

isRecip :: a -> Maybe a Source

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

Instances