poly-graph-0.1.0.0: Polymorphic directed graphs

Safe HaskellNone
LanguageHaskell2010

Data.Graph.Polymorphic

Synopsis

Documentation

data a :~>: b infixr 2 Source

Represents the edge in a directed graph with nodes a and b

Instances

(~~>) a b => a ~~> ((:~>:) b c) Source 
(~~>) a b => (FromMany a) ~~> ((:~>:) b c) Source 
(Eq a, Eq b) => Eq ((:~>:) a b) Source 
(Ord a, Ord b) => Ord ((:~>:) a b) Source 
(Read a, Read b) => Read ((:~>:) a b) Source 
(Show a, Show b) => Show ((:~>:) a b) Source 
Generic ((:~>:) a b) Source 
((~~>) a b, (~~>) b c) => ((:~>:) a b) ~~> c Source 
type Rep ((:~>:) a b) Source 

(~>) :: a ~~> b => a -> b -> a :~>: b infixr 2 Source

Smart constructor which ensures inhabitants of :~>: are linked

pattern (:~>:) :: t -> t -> (:~>:) t t Source

We need to hide PointsTo to enforce use of the smart constructor. But then we lose the ability to pattern match. We recover it by defining a 'read-only' pattern.

class a ~~> b where infixl 3 Source

a ~~> b returns an a linked to b

Methods

(~~>) :: a -> b -> a infixl 3 Source

Instances

(~~>) a b => a ~~> (FromTo b) Source 
(~~>) a b => a ~~> (ToMany b) Source 
(~~>) a b => a ~~> ((:~>:) b c) Source 
((~~>) a b, (~~>) a c) => a ~~> (b, c) Source 
((~~>) a b, (~~>) a c, (~~>) a d) => a ~~> (b, c, d) Source 
((~~>) a b, (~~>) a c, (~~>) a d, (~~>) a e) => a ~~> (b, c, d, e) Source 
((~~>) a b, Functor f) => (f a) ~~> b Source 
(~~>) a b => (FromTo a) ~~> b Source 
(~~>) (FromTo b) c => (ToMany (a, FromTo b)) ~~> c Source 
(~~>) (FromTo a) c => (ToMany (FromTo a, b)) ~~> c Source 
(~~>) a b => (FromMany a) ~~> b Source 
(~~>) a b => (FromMany a) ~~> ((:~>:) b c) Source 
((~~>) a c, (~~>) b c) => (a, b) ~~> c Source 
((~~>) a b, (~~>) b c) => ((:~>:) a b) ~~> c Source 
((~~>) a d, (~~>) b d, (~~>) c d) => (a, b, c) ~~> d Source 
((~~>) a e, (~~>) b e, (~~>) c e, (~~>) d e) => (a, b, c, d) ~~> e Source 

newtype FromMany a Source

FromMany (a, b, ...) :~>: c indicates that each of a, b, ... point to c

Constructors

FromMany a 

Instances

newtype ToMany a Source

a :~>: ToMany (b, c, ...) indicates that a points to each of b, c, ...

Constructors

ToMany a 

Instances

Functor ToMany Source 
(~~>) a b => a ~~> (ToMany b) Source 
Eq a => Eq (ToMany a) Source 
Ord a => Ord (ToMany a) Source 
Read a => Read (ToMany a) Source 
Show a => Show (ToMany a) Source 
Generic (ToMany a) Source 
(~~>) (FromTo b) c => (ToMany (a, FromTo b)) ~~> c Source 
(~~>) (FromTo a) c => (ToMany (FromTo a, b)) ~~> c Source 
type Rep (ToMany a) Source 

newtype FromTo a Source

a :~>: FromTo (b, c, ...) :~>: d indicates that a points to each of b, c, ... which each point to d

Constructors

FromTo a 

Instances

Functor FromTo Source 
(~~>) a b => a ~~> (FromTo b) Source 
Eq a => Eq (FromTo a) Source 
Ord a => Ord (FromTo a) Source 
Read a => Read (FromTo a) Source 
Show a => Show (FromTo a) Source 
Generic (FromTo a) Source 
(~~>) a b => (FromTo a) ~~> b Source 
(~~>) (FromTo b) c => (ToMany (a, FromTo b)) ~~> c Source 
(~~>) (FromTo a) c => (ToMany (FromTo a, b)) ~~> c Source 
type Rep (FromTo a) Source 

type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t Source

For use with e.g. Control.Lens Don't abuse them by updating the pointer field

parent :: Lens (a :~>: b) (c :~>: b) a c Source

child :: Lens (a :~>: b) (a :~>: c) b c Source

toMany :: Lens (ToMany a) (ToMany b) a b Source

fromTo :: Lens (FromTo a) (FromTo b) a b Source