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

Safe HaskellNone
LanguageHaskell98

Data.Field

Contents

Description

A Field is a Ring in which all nonzero elements have a multiplicative inverse.

Synopsis

Field typeclass

class (Euclidean a, Ring a) => Field a Source #

Field represents a field, a ring with a multiplicative inverse for any non-zero element.

Instances
Field Double Source # 
Instance details

Defined in Data.Euclidean

Field Float Source # 
Instance details

Defined in Data.Euclidean

Field () Source # 
Instance details

Defined in Data.Euclidean

Field CFloat Source # 
Instance details

Defined in Data.Euclidean

Field CDouble Source # 
Instance details

Defined in Data.Euclidean

Field Mod2 Source # 
Instance details

Defined in Data.Euclidean

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

Defined in Data.Euclidean

Field a => Field (Complex a) Source # 
Instance details

Defined in Data.Euclidean

Fractional a => Field (WrappedFractional a) Source # 
Instance details

Defined in Data.Euclidean

divide :: Field a => a -> a -> a infixl 7 Source #

Divide two elements of a Field. For any Fractional type, this is the same as '(Prelude./)'.

x divide y = x times recip y

fromRational :: Field a => Rational -> a Source #

Convert from rational to field.

When {-# LANGUAGE RebindableSyntax #-} is enabled, this function is used for desugaring rational literals (like, 2.37). This may be used to facilitate transition from Fractional to Field, because less casts are now required.

recip :: Field a => a -> a Source #

Invert an element of a Field. For any Fractional type, this is the same as recip.

recip x times x = one

(/) :: Field a => a -> a -> a infixl 7 Source #

Infix shorthand for divide.