numhask-0.0.1: A numeric prelude

Safe HaskellNone
LanguageHaskell2010

NumHask.Algebra.Metric

Contents

Description

Metric structure

Synopsis

Metric

class Field a => BoundedField a where Source #

providing the concepts of infinity and NaN, thus moving away from error throwing

Minimal complete definition

isNaN

Methods

maxBound :: a Source #

minBound :: a Source #

nan :: a Source #

isNaN :: a -> Bool Source #

infinity :: BoundedField a => a Source #

prints as Infinity

neginfinity :: BoundedField a => a Source #

prints as `-Infinity`

class Metric a b where Source #

distance between numbers

Minimal complete definition

distance

Methods

distance :: a -> a -> b Source #

class Normed a b where Source #

Normed is a current wart on the NumHask api, causing all sorts of runaway constraint boiler-plate.

Minimal complete definition

size

Methods

size :: a -> b Source #

class (AdditiveUnital a, AdditiveGroup a, Multiplicative a) => Signed a where Source #

abs and signnum are also warts on the standard Num class, and are separated here to provide a cleaner structure.

Minimal complete definition

sign, abs

Methods

sign :: a -> a Source #

abs :: a -> a Source #

Instances

class AdditiveGroup a => Epsilon a where Source #

This should probably be split off into some sort of alternative Equality logic, but to what end?

Minimal complete definition

nearZero, aboutEqual

Methods

nearZero :: a -> Bool Source #

aboutEqual :: a -> a -> Bool Source #

(≈) :: Epsilon a => a -> a -> Bool infixl 4 Source #

utf ???

class Ring a => QuotientField a where Source #

quotient fields also explode constraints if they are polymorphed to emit general integrals

Minimal complete definition

round, ceiling, floor, (^^)

Methods

round :: a -> Integer Source #

ceiling :: a -> Integer Source #

floor :: a -> Integer Source #

(^^) :: a -> Integer -> a Source #