polymap-0.1.1.0: Polygonal maps

Copyright(c) 2015 David Farrell
LicensePublicDomain
Stabilityunstable
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe
LanguageHaskell2010

Data.PolyMap.Relation

Contents

Description

Relation type family and helper function to create relations from tuples.

Synopsis

Relation Type

data family Relation as Source

A relation whose sides are defined by a list of types.

Instances

(Show a, Show (Relation as)) => Show (Relation ((:) * a as)) Source 
Show (Relation ([] *)) Source 
ToRelation (Relation as) as Source 
data Relation ([] *) = UnitRelation Source 
data Relation ((:) * a as) = a :<->: (Relation as) Source 

Query

sideAt :: RelationSideAt n as => Proxy n -> Relation as -> TypeAt n as Source

Retrieve the value at the specified side of the relation.

sideOf :: RelationSideAt n as => Proxy n -> Relation as -> TypeAt n as infix 3 Source

Infix variant of sideAt.

Construction

class ToRelation a as where Source

Typeclass for data types that can be used to construct a relation.

Methods

toRelation :: a -> Relation as Source

Construct a relation from a compatible instance.

Instances

ToRelation () ([] *) Source 
ToRelation a0 ((:) * a0 ([] *)) Source 
ToRelation (Relation as) as Source 
ToRelation (a0, a1) ((:) * a0 ((:) * a1 ([] *))) Source 
ToRelation (a0, a1, a2) ((:) * a0 ((:) * a1 ((:) * a2 ([] *)))) Source 
ToRelation (a0, a1, a2, a3) ((:) * a0 ((:) * a1 ((:) * a2 ((:) * a3 ([] *))))) Source 
ToRelation (a0, a1, a2, a3, a4) ((:) * a0 ((:) * a1 ((:) * a2 ((:) * a3 ((:) * a4 ([] *)))))) Source 
ToRelation (a0, a1, a2, a3, a4, a5) ((:) * a0 ((:) * a1 ((:) * a2 ((:) * a3 ((:) * a4 ((:) * a5 ([] *))))))) Source 
ToRelation (a0, a1, a2, a3, a4, a5, a6) ((:) * a0 ((:) * a1 ((:) * a2 ((:) * a3 ((:) * a4 ((:) * a5 ((:) * a6 ([] *)))))))) Source 
ToRelation (a0, a1, a2, a3, a4, a5, a6, a7) ((:) * a0 ((:) * a1 ((:) * a2 ((:) * a3 ((:) * a4 ((:) * a5 ((:) * a6 ((:) * a7 ([] *))))))))) Source 
ToRelation (a0, a1, a2, a3, a4, a5, a6, a7, a8) ((:) * a0 ((:) * a1 ((:) * a2 ((:) * a3 ((:) * a4 ((:) * a5 ((:) * a6 ((:) * a7 ((:) * a8 ([] *)))))))))) Source 
ToRelation (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) ((:) * a0 ((:) * a1 ((:) * a2 ((:) * a3 ((:) * a4 ((:) * a5 ((:) * a6 ((:) * a7 ((:) * a8 ((:) * a9 ([] *))))))))))) Source