Copyright | (C) Frank Staals |
---|---|
License | see the LICENSE file |
Maintainer | Frank Staals |
Safe Haskell | None |
Language | Haskell2010 |
Defines some generic geometric properties e.g. Dimensions, NumType, and Intersection types.
Synopsis
- type family Dimension t :: Nat
- type family NumType t :: *
- data NoIntersection = NoIntersection
- type Intersection g h = CoRec Identity (IntersectionOf g h)
- type family IntersectionOf g h :: [*]
- coRec :: a ∈ as => a -> CoRec Identity as
- class IsIntersectableWith g h where
- intersect :: g -> h -> Intersection g h
- intersects :: g -> h -> Bool
- nonEmptyIntersection :: proxy g -> proxy h -> Intersection g h -> Bool
- type AlwaysTrueIntersection g h = RecApplicative (IntersectionOf g h)
- defaultNonEmptyIntersection :: forall g h proxy. (NoIntersection ∈ IntersectionOf g h, RecApplicative (IntersectionOf g h)) => proxy g -> proxy h -> Intersection g h -> Bool
- type family Union g h :: *
- class IsUnionableWith g h where
Documentation
type family Dimension t :: Nat Source #
A type family for types that are associated with a dimension. The dimension is the dimension of the geometry they are embedded in.
Instances
type family NumType t :: * Source #
A type family for types that have an associated numeric type.
Instances
data NoIntersection Source #
A simple data type expressing that there are no intersections
Instances
Eq NoIntersection Source # | |
Defined in Data.Geometry.Properties (==) :: NoIntersection -> NoIntersection -> Bool # (/=) :: NoIntersection -> NoIntersection -> Bool # | |
Ord NoIntersection Source # | |
Defined in Data.Geometry.Properties compare :: NoIntersection -> NoIntersection -> Ordering # (<) :: NoIntersection -> NoIntersection -> Bool # (<=) :: NoIntersection -> NoIntersection -> Bool # (>) :: NoIntersection -> NoIntersection -> Bool # (>=) :: NoIntersection -> NoIntersection -> Bool # max :: NoIntersection -> NoIntersection -> NoIntersection # min :: NoIntersection -> NoIntersection -> NoIntersection # | |
Read NoIntersection Source # | |
Defined in Data.Geometry.Properties readsPrec :: Int -> ReadS NoIntersection # readList :: ReadS [NoIntersection] # | |
Show NoIntersection Source # | |
Defined in Data.Geometry.Properties showsPrec :: Int -> NoIntersection -> ShowS # show :: NoIntersection -> String # showList :: [NoIntersection] -> ShowS # |
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
class IsIntersectableWith g h where Source #
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
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