hgeometry-0.10.0.0: Geometric Algorithms, Data structures, and Data types.

Safe HaskellNone
LanguageHaskell2010

Data.Geometry.Interval

Contents

Synopsis

1 dimensional Intervals

newtype Interval a r Source #

An Interval is essentially a Range but with possible payload

Constructors

GInterval 

Fields

Instances
Bifunctor Interval Source # 
Instance details

Defined in Data.Geometry.Interval

Methods

bimap :: (a -> b) -> (c -> d) -> Interval a c -> Interval b d #

first :: (a -> b) -> Interval a c -> Interval b c #

second :: (b -> c) -> Interval a b -> Interval a c #

Functor (Interval a) Source # 
Instance details

Defined in Data.Geometry.Interval

Methods

fmap :: (a0 -> b) -> Interval a a0 -> Interval a b #

(<$) :: a0 -> Interval a b -> Interval a a0 #

Foldable (Interval a) Source # 
Instance details

Defined in Data.Geometry.Interval

Methods

fold :: Monoid m => Interval a m -> m #

foldMap :: Monoid m => (a0 -> m) -> Interval a a0 -> m #

foldr :: (a0 -> b -> b) -> b -> Interval a a0 -> b #

foldr' :: (a0 -> b -> b) -> b -> Interval a a0 -> b #

foldl :: (b -> a0 -> b) -> b -> Interval a a0 -> b #

foldl' :: (b -> a0 -> b) -> b -> Interval a a0 -> b #

foldr1 :: (a0 -> a0 -> a0) -> Interval a a0 -> a0 #

foldl1 :: (a0 -> a0 -> a0) -> Interval a a0 -> a0 #

toList :: Interval a a0 -> [a0] #

null :: Interval a a0 -> Bool #

length :: Interval a a0 -> Int #

elem :: Eq a0 => a0 -> Interval a a0 -> Bool #

maximum :: Ord a0 => Interval a a0 -> a0 #

minimum :: Ord a0 => Interval a a0 -> a0 #

sum :: Num a0 => Interval a a0 -> a0 #

product :: Num a0 => Interval a a0 -> a0 #

Traversable (Interval a) Source # 
Instance details

Defined in Data.Geometry.Interval

Methods

traverse :: Applicative f => (a0 -> f b) -> Interval a a0 -> f (Interval a b) #

sequenceA :: Applicative f => Interval a (f a0) -> f (Interval a a0) #

mapM :: Monad m => (a0 -> m b) -> Interval a a0 -> m (Interval a b) #

sequence :: Monad m => Interval a (m a0) -> m (Interval a a0) #

(Eq r, Eq a) => Eq (Interval a r) Source # 
Instance details

Defined in Data.Geometry.Interval

Methods

(==) :: Interval a r -> Interval a r -> Bool #

(/=) :: Interval a r -> Interval a r -> Bool #

(Show a, Show r) => Show (Interval a r) Source # 
Instance details

Defined in Data.Geometry.Interval

Methods

showsPrec :: Int -> Interval a r -> ShowS #

show :: Interval a r -> String #

showList :: [Interval a r] -> ShowS #

Generic (Interval a r) Source # 
Instance details

Defined in Data.Geometry.Interval

Associated Types

type Rep (Interval a r) :: Type -> Type #

Methods

from :: Interval a r -> Rep (Interval a r) x #

to :: Rep (Interval a r) x -> Interval a r #

(Arbitrary r, Arbitrary a, Ord r, Ord a) => Arbitrary (Interval a r) Source # 
Instance details

Defined in Data.Geometry.Interval

Methods

arbitrary :: Gen (Interval a r) #

shrink :: Interval a r -> [Interval a r] #

(NFData a, NFData r) => NFData (Interval a r) Source # 
Instance details

Defined in Data.Geometry.Interval

Methods

rnf :: Interval a r -> () #

HasEnd (Interval a r) Source # 
Instance details

Defined in Data.Geometry.Interval

Associated Types

type EndCore (Interval a r) :: Type Source #

type EndExtra (Interval a r) :: Type Source #

Methods

end :: Lens' (Interval a r) (EndCore (Interval a r) :+ EndExtra (Interval a r)) Source #

HasStart (Interval a r) Source # 
Instance details

Defined in Data.Geometry.Interval

Associated Types

type StartCore (Interval a r) :: Type Source #

type StartExtra (Interval a r) :: Type Source #

IntervalLike (Interval p r) Source # 
Instance details

Defined in Data.Geometry.IntervalTree

Methods

toRange :: Interval p r -> Range (NumType (Interval p r)) Source #

Ord r => IsIntersectableWith (Interval a r) (Interval a r) Source # 
Instance details

Defined in Data.Geometry.Interval

Methods

intersect :: Interval a r -> Interval a r -> Intersection (Interval a r) (Interval a r) #

intersects :: Interval a r -> Interval a r -> Bool #

nonEmptyIntersection :: proxy (Interval a r) -> proxy (Interval a r) -> Intersection (Interval a r) (Interval a r) -> Bool #

type Rep (Interval a r) Source # 
Instance details

Defined in Data.Geometry.Interval

type Rep (Interval a r) = D1 (MetaData "Interval" "Data.Geometry.Interval" "hgeometry-0.10.0.0-58coE6gW4i4HcLJr7kmg1f" True) (C1 (MetaCons "GInterval" PrefixI True) (S1 (MetaSel (Just "_unInterval") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Range (r :+ a)))))
type NumType (Interval a r) Source # 
Instance details

Defined in Data.Geometry.Interval

type NumType (Interval a r) = r
type Dimension (Interval a r) Source # 
Instance details

Defined in Data.Geometry.Interval

type Dimension (Interval a r) = 1
type EndCore (Interval a r) Source # 
Instance details

Defined in Data.Geometry.Interval

type EndCore (Interval a r) = r
type EndExtra (Interval a r) Source # 
Instance details

Defined in Data.Geometry.Interval

type EndExtra (Interval a r) = a
type StartCore (Interval a r) Source # 
Instance details

Defined in Data.Geometry.Interval

type StartCore (Interval a r) = r
type StartExtra (Interval a r) Source # 
Instance details

Defined in Data.Geometry.Interval

type StartExtra (Interval a r) = a
type IntersectionOf (Interval a r) (Interval a r) Source # 
Instance details

Defined in Data.Geometry.Interval

type IntersectionOf (Interval a r) (Interval a r) = NoIntersection ': (Interval a r ': ([] :: [Type]))

pattern OpenInterval :: (r :+ a) -> (r :+ a) -> Interval a r Source #

pattern ClosedInterval :: (r :+ a) -> (r :+ a) -> Interval a r Source #

pattern Interval :: EndPoint (r :+ a) -> EndPoint (r :+ a) -> Interval a r Source #

querying the start and end of intervals

class HasStart t where Source #

Associated Types

type StartCore t Source #

type StartExtra t Source #

Instances
HasStart (Interval a r) Source # 
Instance details

Defined in Data.Geometry.Interval

Associated Types

type StartCore (Interval a r) :: Type Source #

type StartExtra (Interval a r) :: Type Source #

HasStart (HalfLine d r) Source # 
Instance details

Defined in Data.Geometry.HalfLine

Associated Types

type StartCore (HalfLine d r) :: Type Source #

type StartExtra (HalfLine d r) :: Type Source #

HasStart (LineSegment d p r) Source # 
Instance details

Defined in Data.Geometry.LineSegment

Associated Types

type StartCore (LineSegment d p r) :: Type Source #

type StartExtra (LineSegment d p r) :: Type Source #

class HasEnd t where Source #

Associated Types

type EndCore t Source #

type EndExtra t Source #

Methods

end :: Lens' t (EndCore t :+ EndExtra t) Source #

Instances
HasEnd (Interval a r) Source # 
Instance details

Defined in Data.Geometry.Interval

Associated Types

type EndCore (Interval a r) :: Type Source #

type EndExtra (Interval a r) :: Type Source #

Methods

end :: Lens' (Interval a r) (EndCore (Interval a r) :+ EndExtra (Interval a r)) Source #

HasEnd (LineSegment d p r) Source # 
Instance details

Defined in Data.Geometry.LineSegment

Associated Types

type EndCore (LineSegment d p r) :: Type Source #

type EndExtra (LineSegment d p r) :: Type Source #

Methods

end :: Lens' (LineSegment d p r) (EndCore (LineSegment d p r) :+ EndExtra (LineSegment d p r)) Source #

Working with intervals

inInterval :: Ord r => r -> Interval a r -> Bool Source #

Test if a value lies in an interval. Note that the difference between inInterval and inRange is that the extra value is *not* used in the comparison with inInterval, whereas it is in inRange.

shiftLeft' :: Num r => r -> Interval a r -> Interval a r Source #

module Data.Range