-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | numerical spaces -- -- Spaces as higher-kinded numbers. @package numhask-space @version 0.1.1 module NumHask.Analysis.Space -- | a continuous set of numbers mathematics does not define a space, so -- library devs are free to experiment. -- --
--   a `contains` union a b && b `contains` union a b
--   lower a \/ upper a == lower a
--   lower a /\ upper a == upper a
--   
class (Spaceable (Element s)) => Space s where { -- | the underlying element in the space type family Element s :: *; } -- | lower boundary lower :: Space s => s -> Element s -- | upper boundary upper :: Space s => s -> Element s -- | space containing a single element singleton :: Space s => Element s -> s -- | the intersection of two spaces intersection :: Space s => s -> s -> s -- | the union of two spaces union :: Space s => s -> s -> s -- | Normalise a space so that > lower a / upper a == lower a > lower -- a / upper a == upper a norm :: Space s => s -> s -- | create a normalised space from two elements (...) :: Space s => Element s -> Element s -> s -- | create a space from two elements witjout normalising (>.<) :: Space s => Element s -> Element s -> s infix 3 >.< infix 3 ... type Spaceable a = (Eq a, JoinSemiLattice a, MeetSemiLattice a) newtype Union a Union :: a -> Union a [getUnion] :: Union a -> a newtype Intersection a Intersection :: a -> Intersection a [getIntersection] :: Intersection a -> a -- | a space that can be divided neatly class (Space s, Subtractive (Element s), Field (Element s)) => FieldSpace s where { type family Grid s :: *; } -- | create equally-spaced elements across a space grid :: FieldSpace s => Pos -> s -> Grid s -> [Element s] -- | create equally-spaced spaces from a space gridSpace :: FieldSpace s => s -> Grid s -> [s] -- | mid-point of the space mid :: (Space s, Field (Element s)) => s -> Element s -- | project a data point from one space to another, preserving relative -- position -- --
--   project o n (lower o) = lower n
--   project o n (upper o) = upper n
--   project a a x = x
--   
project :: (Space s, Field (Element s), Subtractive (Element s)) => s -> s -> Element s -> Element s -- | Pos suggests where points should be placed in forming a grid across a -- field space. data Pos OuterPos :: Pos InnerPos :: Pos LowerPos :: Pos UpperPos :: Pos MidPos :: Pos -- | the containing space of a non-empty Foldable space1 :: (Space s, Traversable f) => f (Element s) -> s -- | is an element in the space (|.|) :: Space s => Element s -> s -> Bool infixl 7 |.| memberOf :: Space s => Element s -> s -> Bool -- | is a space contained within another? contains :: Space s => s -> s -> Bool -- | are two spaces disjoint? disjoint :: Space s => s -> s -> Bool -- | is one space completely above the other (|>|) :: Space s => s -> s -> Bool infixl 7 |>| -- | is one space completely below the other (|<|) :: Space s => s -> s -> Bool infixl 7 |<| -- | distance between boundaries width :: (Space s, Subtractive (Element s)) => s -> Element s -- | create a space centered on a plus or minus b (+/-) :: (Space s, Subtractive (Element s)) => Element s -> Element s -> s infixl 6 +/- -- | lift a monotone function (increasing or decreasing) over a given space monotone :: (Space a, Space b) => (Element a -> Element b) -> a -> b -- | a big, big space whole :: (Space s, BoundedJoinSemiLattice (Element s), BoundedMeetSemiLattice (Element s)) => s -- | a negative space negWhole :: (Space s, BoundedJoinSemiLattice (Element s), BoundedMeetSemiLattice (Element s)) => s -- | a small space eps :: (Space s, Epsilon (Element s), Multiplicative (Element s)) => Element s -> Element s -> s -- | widen a space widen :: (Space s, Subtractive (Element s)) => Element s -> s -> s -- | widen by a small amount widenEps :: (Space s, Epsilon (Element s), Multiplicative (Element s)) => Element s -> s -> s instance GHC.Classes.Eq NumHask.Analysis.Space.Pos instance GHC.Show.Show NumHask.Analysis.Space.Pos instance NumHask.Analysis.Space.Space a => GHC.Base.Semigroup (NumHask.Analysis.Space.Intersection a) instance (NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice a, NumHask.Analysis.Space.Space a) => GHC.Base.Monoid (NumHask.Analysis.Space.Intersection a) instance NumHask.Analysis.Space.Space a => GHC.Base.Semigroup (NumHask.Analysis.Space.Union a) instance (NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice a, NumHask.Analysis.Space.Space a) => GHC.Base.Monoid (NumHask.Analysis.Space.Union a) -- | An Space with no empty, a semigroup based on a convex hull union, and -- a monoid on a negative space. module NumHask.Data.Range -- | A continuous range over type a -- --
--   >>> let a = Range (-1) 1
--   
--   >>> a
--   Range -1 1
--   
--   >>> fmap (+1) (Range 1 2)
--   Range 2 3
--   
--   >>> one :: Range Double
--   Range -0.5 0.5
--   
--   >>> zero :: Range Double
--   Range Infinity -Infinity
--   
-- -- as a Field instance -- --
--   >>> Range 0 1 + zero
--   Range 0.0 1.0
--   
--   >>> Range 0 1 + Range 2 3
--   Range 0.0 3.0
--   
--   >>> Range 1 1 - one
--   Range 0.5 1.0
--   
--   >>> Range 0 1 * one
--   Range 0.0 1.0
--   
--   >>> Range 0 1 / one
--   Range 0.0 1.0
--   
--   >>> abs (Range 1 0)
--   Range 0.0 1.0
--   
--   >>> sign (Range 1 0) == negate one
--   True
--   
-- -- Idempotent -- --
--   >>> Range 0 2 + Range 0 2
--   Range 0.0 2.0
--   
-- -- as a space instance -- --
--   >>> NumHask.Space.project (Range 0 1) (Range 1 4) 0.5
--   2.5
--   
--   >>> NumHask.Space.grid NumHask.Space.OuterPos (Range 0 10) 5
--   [0.0,2.0,4.0,6.0,8.0,10.0]
--   
--   >>> NumHask.Space.gridSpace (Range 0 1) 4
--   [Range 0.0 0.25,Range 0.25 0.5,Range 0.5 0.75,Range 0.75 1.0]
--   
--   >>> gridSensible NumHask.Space.OuterPos (Range (-12.0) 23.0) 6
--   [-10.0,-5.0,0.0,5.0,10.0,15.0,20.0]
--   
newtype Range a Range' :: (a, a) -> Range a -- | A tuple is the preferred concrete implementation of a Range, due to -- many libraries having substantial optimizations for tuples already (eg -- Vector). 'Pattern Synonyms' allow us to recover a constructor -- without the need for tuple syntax. pattern Range :: a -> a -> Range a gridSensible :: (Ord a, JoinSemiLattice a, FromInteger a, FromRatio a, QuotientField a Integer, ExpField a, Epsilon a) => Pos -> Bool -> Range a -> Integer -> [a] instance GHC.Generics.Generic (NumHask.Data.Range.Range a) instance GHC.Classes.Eq a => GHC.Classes.Eq (NumHask.Data.Range.Range a) instance GHC.Show.Show a => GHC.Show.Show (NumHask.Data.Range.Range a) instance Data.Functor.Classes.Eq1 NumHask.Data.Range.Range instance Data.Functor.Classes.Show1 NumHask.Data.Range.Range instance GHC.Base.Functor NumHask.Data.Range.Range instance Data.Functor.Bind.Class.Apply NumHask.Data.Range.Range instance GHC.Base.Applicative NumHask.Data.Range.Range instance Data.Foldable.Foldable NumHask.Data.Range.Range instance Data.Semigroup.Foldable.Class.Foldable1 NumHask.Data.Range.Range instance Data.Traversable.Traversable NumHask.Data.Range.Range instance Data.Semigroup.Traversable.Class.Traversable1 NumHask.Data.Range.Range instance Data.Distributive.Distributive NumHask.Data.Range.Range instance Data.Functor.Rep.Representable NumHask.Data.Range.Range instance NumHask.Algebra.Abstract.Lattice.JoinSemiLattice a => NumHask.Algebra.Abstract.Lattice.JoinSemiLattice (NumHask.Data.Range.Range a) instance NumHask.Algebra.Abstract.Lattice.MeetSemiLattice a => NumHask.Algebra.Abstract.Lattice.MeetSemiLattice (NumHask.Data.Range.Range a) instance NumHask.Algebra.Abstract.Lattice.BoundedLattice a => NumHask.Algebra.Abstract.Lattice.BoundedJoinSemiLattice (NumHask.Data.Range.Range a) instance NumHask.Algebra.Abstract.Lattice.BoundedLattice a => NumHask.Algebra.Abstract.Lattice.BoundedMeetSemiLattice (NumHask.Data.Range.Range a) instance NumHask.Algebra.Abstract.Lattice.Lattice a => NumHask.Analysis.Space.Space (NumHask.Data.Range.Range a) instance (NumHask.Algebra.Abstract.Lattice.Lattice a, NumHask.Algebra.Abstract.Field.Field a, NumHask.Algebra.Abstract.Additive.Subtractive a, NumHask.Data.Integral.FromInteger a) => NumHask.Analysis.Space.FieldSpace (NumHask.Data.Range.Range a) instance NumHask.Algebra.Abstract.Lattice.BoundedLattice a => GHC.Base.Semigroup (NumHask.Data.Range.Range a) instance NumHask.Algebra.Abstract.Lattice.BoundedLattice a => GHC.Base.Monoid (NumHask.Data.Range.Range a) instance (NumHask.Algebra.Abstract.Additive.Additive a, NumHask.Algebra.Abstract.Lattice.Lattice a) => NumHask.Algebra.Abstract.Additive.Additive (NumHask.Data.Range.Range a) instance (NumHask.Algebra.Abstract.Additive.Subtractive a, NumHask.Algebra.Abstract.Lattice.Lattice a) => NumHask.Algebra.Abstract.Additive.Subtractive (NumHask.Data.Range.Range a) instance (NumHask.Algebra.Abstract.Multiplicative.Multiplicative a, NumHask.Algebra.Abstract.Lattice.Lattice a) => NumHask.Algebra.Abstract.Multiplicative.Multiplicative (NumHask.Data.Range.Range a) instance (NumHask.Algebra.Abstract.Lattice.BoundedLattice a, NumHask.Analysis.Metric.Epsilon a, NumHask.Algebra.Abstract.Multiplicative.Divisive a) => NumHask.Algebra.Abstract.Multiplicative.Divisive (NumHask.Data.Range.Range a) instance (NumHask.Algebra.Abstract.Multiplicative.Multiplicative a, NumHask.Algebra.Abstract.Additive.Subtractive a, NumHask.Algebra.Abstract.Lattice.Lattice a) => NumHask.Analysis.Metric.Signed (NumHask.Data.Range.Range a) instance (NumHask.Data.Integral.FromInteger a, NumHask.Algebra.Abstract.Lattice.Lattice a) => NumHask.Data.Integral.FromInteger (NumHask.Data.Range.Range a) instance NumHask.Algebra.Abstract.Additive.Additive a => NumHask.Algebra.Abstract.Action.AdditiveAction (NumHask.Data.Range.Range a) instance NumHask.Algebra.Abstract.Additive.Subtractive a => NumHask.Algebra.Abstract.Action.SubtractiveAction (NumHask.Data.Range.Range a) instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative a => NumHask.Algebra.Abstract.Action.MultiplicativeAction (NumHask.Data.Range.Range a) instance NumHask.Algebra.Abstract.Multiplicative.Divisive a => NumHask.Algebra.Abstract.Action.DivisiveAction (NumHask.Data.Range.Range a) -- | representation of a possibly discontinuous interval module NumHask.Data.RangeD newtype RangeD a RangeD :: [Range a] -> RangeD a normalise :: (Ord a, Lattice a, Subtractive a) => RangeD a -> RangeD a instance Data.Traversable.Traversable NumHask.Data.RangeD.RangeD instance Data.Foldable.Foldable NumHask.Data.RangeD.RangeD instance GHC.Base.Functor NumHask.Data.RangeD.RangeD instance GHC.Show.Show a => GHC.Show.Show (NumHask.Data.RangeD.RangeD a) instance GHC.Generics.Generic (NumHask.Data.RangeD.RangeD a) instance GHC.Classes.Eq a => GHC.Classes.Eq (NumHask.Data.RangeD.RangeD a) instance (GHC.Classes.Ord a, NumHask.Algebra.Abstract.Lattice.Lattice a, NumHask.Algebra.Abstract.Additive.Subtractive a) => NumHask.Algebra.Abstract.Additive.Additive (NumHask.Data.RangeD.RangeD a) instance (NumHask.Algebra.Abstract.Multiplicative.Divisive a, GHC.Classes.Ord a, NumHask.Algebra.Abstract.Lattice.Lattice a, NumHask.Algebra.Abstract.Additive.Subtractive a) => NumHask.Algebra.Abstract.Additive.Subtractive (NumHask.Data.RangeD.RangeD a) instance (GHC.Classes.Ord a, NumHask.Algebra.Abstract.Lattice.Lattice a, NumHask.Algebra.Abstract.Additive.Subtractive a, NumHask.Algebra.Abstract.Multiplicative.Multiplicative a) => NumHask.Algebra.Abstract.Multiplicative.Multiplicative (NumHask.Data.RangeD.RangeD a) instance (NumHask.Algebra.Abstract.Multiplicative.Multiplicative a, NumHask.Algebra.Abstract.Lattice.BoundedLattice a, NumHask.Analysis.Metric.Epsilon a, GHC.Classes.Ord a, NumHask.Algebra.Abstract.Additive.Subtractive a, NumHask.Algebra.Abstract.Multiplicative.Divisive a) => NumHask.Algebra.Abstract.Multiplicative.Divisive (NumHask.Data.RangeD.RangeD a) -- | a two-dimensional plane, implemented as a composite of a Pair -- of Ranges. module NumHask.Data.Rect -- | a Pair of Ranges that form a rectangle in what is often -- thought of as the XY plane. -- --
--   >>> let a = Rect (-1) 1 (-2) 4
--   
--   >>> a
--   Rect -1 1 -2 4
--   
--   >>> let (Ranges x y) = a
--   
--   >>> x
--   Range -1 1
--   
--   >>> y
--   Range -2 4
--   
--   >>> fmap (+1) (Rect 1 2 3 4)
--   Rect 2 3 4 5
--   
--   >>> one :: Rect Double
--   Rect -0.5 0.5 -0.5 0.5
--   
--   >>> zero :: Rect Double
--   Rect Infinity -Infinity Infinity -Infinity
--   
-- -- as a Field instance -- --
--   >>> Rect 0 1 2 3 + zero
--   Rect 0.0 1.0 2.0 3.0
--   
--   >>> Rect 0 1 (-2) (-1) + Rect 2 3 (-5) 3
--   Rect 0.0 3.0 -5.0 3.0
--   
--   >>> Rect 1 1 1 1 - one
--   Rect 0.5 1.0 0.5 1.0
--   
--   >>> Rect 0 1 0 1 * one
--   Rect 0.0 1.0 0.0 1.0
--   
--   >>> Rect 0 1 0 1 / one
--   Rect 0.0 1.0 0.0 1.0
--   
--   >>> singleton (Pair 1.0 2.0) :: Rect Double
--   Rect 1.0 1.0 2.0 2.0
--   
--   >>> abs (Rect 1 0 1 0)
--   Rect 0.0 1.0 0.0 1.0
--   
--   >>> sign (Rect 1 0 1 0) == negate one
--   True
--   
-- -- as a Space instance -- --
--   >>> project (Rect 0 1 (-1) 0) (Rect 1 4 10 0) (Pair 0.5 1)
--   Pair 2.5 -10.0
--   
--   >>> gridSpace (Rect 0 10 0 1) (Pair 2 2)
--   [Rect 0.0 5.0 0.0 0.5,Rect 0.0 5.0 0.5 1.0,Rect 5.0 10.0 0.0 0.5,Rect 5.0 10.0 0.5 1.0]
--   
--   >>> grid MidPos (Rect 0 10 0 1) (Pair 2 2)
--   [Pair 2.5 0.25,Pair 2.5 0.75,Pair 7.5 0.25,Pair 7.5 0.75]
--   
newtype Rect a Rect' :: Compose Pair Range a -> Rect a -- | pattern of Rect lowerx upperx lowery uppery pattern Rect :: a -> a -> a -> a -> Rect a -- | pattern of Ranges xrange yrange pattern Ranges :: Range a -> Range a -> Rect a -- | create a list of pairs representing the lower left and upper right -- cormners of a rectangle. corners :: Lattice a => Rect a -> [Pair a] -- | project a Rect from an old range to a new one projectRect :: (Lattice a, Subtractive a, Field a) => Rect a -> Rect a -> Rect a -> Rect a instance GHC.Generics.Generic (NumHask.Data.Rect.Rect a) instance Data.Traversable.Traversable NumHask.Data.Rect.Rect instance Data.Foldable.Foldable NumHask.Data.Rect.Rect instance GHC.Base.Applicative NumHask.Data.Rect.Rect instance GHC.Base.Functor NumHask.Data.Rect.Rect instance GHC.Classes.Eq a => GHC.Classes.Eq (NumHask.Data.Rect.Rect a) instance GHC.Show.Show a => GHC.Show.Show (NumHask.Data.Rect.Rect a) instance Data.Distributive.Distributive NumHask.Data.Rect.Rect instance Data.Functor.Rep.Representable NumHask.Data.Rect.Rect instance NumHask.Algebra.Abstract.Lattice.BoundedLattice a => GHC.Base.Semigroup (NumHask.Data.Rect.Rect a) instance NumHask.Algebra.Abstract.Lattice.BoundedLattice a => GHC.Base.Monoid (NumHask.Data.Rect.Rect a) instance NumHask.Algebra.Abstract.Lattice.Lattice a => NumHask.Analysis.Space.Space (NumHask.Data.Rect.Rect a) instance (NumHask.Algebra.Abstract.Lattice.Lattice a, NumHask.Algebra.Abstract.Field.Field a, NumHask.Algebra.Abstract.Additive.Subtractive a, NumHask.Data.Integral.FromInteger a) => NumHask.Analysis.Space.FieldSpace (NumHask.Data.Rect.Rect a) instance NumHask.Algebra.Abstract.Additive.Additive a => NumHask.Algebra.Abstract.Action.AdditiveAction (NumHask.Data.Rect.Rect a) instance NumHask.Algebra.Abstract.Additive.Subtractive a => NumHask.Algebra.Abstract.Action.SubtractiveAction (NumHask.Data.Rect.Rect a) instance NumHask.Algebra.Abstract.Multiplicative.Multiplicative a => NumHask.Algebra.Abstract.Action.MultiplicativeAction (NumHask.Data.Rect.Rect a) instance NumHask.Algebra.Abstract.Multiplicative.Divisive a => NumHask.Algebra.Abstract.Action.DivisiveAction (NumHask.Data.Rect.Rect a)