Skip to content

Update Field #170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions src/Data/Field.purs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,9 @@ import Data.Semiring (class Semiring, add, mul, one, zero, (*), (+))

-- | The `Field` class is for types that are (commutative) fields.
-- |
-- | Instances must satisfy the following law in addition to the
-- | `EuclideanRing` laws:
-- |
-- | - Non-zero multiplicative inverse: ``a `mod` b = zero`` for all `a` and `b`
-- |
-- | If a type has a `Field` instance, it should also have a `DivisionRing`
-- | instance. In a future release, `DivisionRing` may become a superclass of
-- | `Field`.
class EuclideanRing a <= Field a
-- | `Field`s are exactly `EuclideanRing` + `CommutativeRing` so this class
-- | exists as a convenience, so a single constraint can be used when field-like
-- | behaviour is expected.
class (EuclideanRing a, CommutativeRing a) <= Field a

instance fieldNumber :: Field Number
instance fieldNumber :: (EuclideanRing a, CommutativeRing a) => Field a