numhask-range-0.1.3.0: Numbers that are range representations

Safe HaskellSafe
LanguageHaskell2010

NumHask.Space

Description

A Space represents an abstract continuous range class for a type. The interval package is an alternative approach.

Synopsis

Documentation

class (Eq (Element s), Ord (Element s), Field (Element s)) => Space s where #

space laws

a `union` nul == a
a `union` a == a
project o n (lower o) == lower n
project o n (upper o) == upper n
project a a == id

Minimal complete definition

lower, upper, singleton, union, nul, grid, gridSpace

Associated Types

type Element s :: * #

type Grid s :: * #

Methods

lower :: s -> Element s #

lower boundary of space

upper :: s -> Element s #

upper boundary of space

mid :: s -> Element s #

mid-point of the space

width :: s -> Element s #

distance between boundaries

singleton :: Element s -> s #

singleton space

singular :: s -> Bool #

zero-width test

element :: Element s -> s -> Bool #

determine whether an a is in the space

contains :: s -> s -> Bool #

is a space contained within another?

disjoint :: s -> s -> Bool #

do two spaces intersect?

intersects :: s -> s -> Bool #

do two spaces intersect?

union :: s -> s -> s #

convex hull

nul :: s #

null space, which can be interpreted as mempty

space :: Foldable f => f (Element s) -> s #

the containing space of a Foldable

project :: s -> s -> Element s -> Element s #

project a data point from an old range to a new range

grid :: Pos -> s -> Grid s -> [Element s] #

create equally-spaced as from a space

gridSpace :: s -> Grid s -> [s] #

create equally-spaced `Space a`s from a space

Instances

(FromInteger a, Ord a, BoundedField a) => Space (Range a) # 

Associated Types

type Element (Range a) :: * #

type Grid (Range a) :: * #

Methods

lower :: Range a -> Element (Range a) #

upper :: Range a -> Element (Range a) #

mid :: Range a -> Element (Range a) #

width :: Range a -> Element (Range a) #

singleton :: Element (Range a) -> Range a #

singular :: Range a -> Bool #

element :: Element (Range a) -> Range a -> Bool #

contains :: Range a -> Range a -> Bool #

disjoint :: Range a -> Range a -> Bool #

intersects :: Range a -> Range a -> Bool #

union :: Range a -> Range a -> Range a #

nul :: Range a #

space :: Foldable f => f (Element (Range a)) -> Range a #

project :: Range a -> Range a -> Element (Range a) -> Element (Range a) #

grid :: Pos -> Range a -> Grid (Range a) -> [Element (Range a)] #

gridSpace :: Range a -> Grid (Range a) -> [Range a] #

(Signed a, FromInteger a, Ord a, BoundedField a) => Space (Rect a) # 

Associated Types

type Element (Rect a) :: * #

type Grid (Rect a) :: * #

Methods

lower :: Rect a -> Element (Rect a) #

upper :: Rect a -> Element (Rect a) #

mid :: Rect a -> Element (Rect a) #

width :: Rect a -> Element (Rect a) #

singleton :: Element (Rect a) -> Rect a #

singular :: Rect a -> Bool #

element :: Element (Rect a) -> Rect a -> Bool #

contains :: Rect a -> Rect a -> Bool #

disjoint :: Rect a -> Rect a -> Bool #

intersects :: Rect a -> Rect a -> Bool #

union :: Rect a -> Rect a -> Rect a #

nul :: Rect a #

space :: Foldable f => f (Element (Rect a)) -> Rect a #

project :: Rect a -> Rect a -> Element (Rect a) -> Element (Rect a) #

grid :: Pos -> Rect a -> Grid (Rect a) -> [Element (Rect a)] #

gridSpace :: Rect a -> Grid (Rect a) -> [Rect a] #

data Pos #

Pos suggests where data points are placed on a grid across a range. Pos can also be thought about as whether the lower and upper points on the range are open or closed (plus the mid-point as an extra option).

Instances

Eq Pos # 

Methods

(==) :: Pos -> Pos -> Bool #

(/=) :: Pos -> Pos -> Bool #

Show Pos # 

Methods

showsPrec :: Int -> Pos -> ShowS #

show :: Pos -> String #

showList :: [Pos] -> ShowS #

Generic Pos # 

Associated Types

type Rep Pos :: * -> * #

Methods

from :: Pos -> Rep Pos x #

to :: Rep Pos x -> Pos #

type Rep Pos # 
type Rep Pos = D1 * (MetaData "Pos" "NumHask.Space" "numhask-range-0.1.3.0-LpINvSFIDg8V2nKB8BO37" False) ((:+:) * ((:+:) * (C1 * (MetaCons "OuterPos" PrefixI False) (U1 *)) (C1 * (MetaCons "InnerPos" PrefixI False) (U1 *))) ((:+:) * (C1 * (MetaCons "LowerPos" PrefixI False) (U1 *)) ((:+:) * (C1 * (MetaCons "UpperPos" PrefixI False) (U1 *)) (C1 * (MetaCons "MidPos" PrefixI False) (U1 *)))))