hgeometry-combinatorial-0.10.0.0: Data structures, and Data types.

Copyright(C) Frank Staals
Licensesee the LICENSE file
MaintainerFrank Staals
Safe HaskellNone
LanguageHaskell2010

Data.Intersection

Description

Defines a data type for representing intersections. Mostly useful for the more geometric types.

Synopsis

Documentation

type Intersection g h = CoRec Identity (IntersectionOf g h) Source #

The result of interesecting two geometries is a CoRec,

type family IntersectionOf g h :: [*] Source #

The type family specifying the list of possible result types of an intersection.

Instances
type IntersectionOf (Range a) (Range a) Source # 
Instance details

Defined in Data.Range

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

coRec :: a as => a -> CoRec Identity as Source #

Helper to produce a corec

class IsIntersectableWith g h where Source #

Minimal complete definition

intersect, nonEmptyIntersection

Methods

intersect :: g -> h -> Intersection g h Source #

intersects :: g -> h -> Bool Source #

g intersects h = The intersection of g and h is non-empty.

The default implementation computes the intersection of g and h, and uses nonEmptyIntersection to determine if the intersection is non-empty.

nonEmptyIntersection :: proxy g -> proxy h -> Intersection g h -> Bool Source #

Helper to implement intersects.

nonEmptyIntersection :: (NoIntersection IntersectionOf g h, RecApplicative (IntersectionOf g h)) => proxy g -> proxy h -> Intersection g h -> Bool Source #

Helper to implement intersects.

Instances
Ord a => IsIntersectableWith (Range a) (Range a) Source # 
Instance details

Defined in Data.Range

Methods

intersect :: Range a -> Range a -> Intersection (Range a) (Range a) Source #

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

nonEmptyIntersection :: proxy (Range a) -> proxy (Range a) -> Intersection (Range a) (Range a) -> Bool Source #

type AlwaysTrueIntersection g h = RecApplicative (IntersectionOf g h) Source #

When using IntersectionOf we may need some constraints that are always true anyway.

defaultNonEmptyIntersection :: forall g h proxy. (NoIntersection IntersectionOf g h, RecApplicative (IntersectionOf g h)) => proxy g -> proxy h -> Intersection g h -> Bool Source #

Returns True iff the result is *not* a NoIntersection