fcf-graphs-0.0.1.0: Type-level version of algebraic-graphs.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Fcf.Data.AdjacencyMap

Synopsis

Documentation

newtype AdjacencyMap a Source #

Constructors

AM (MapC a (Set a)) 

Instances

Instances details
type Eval (Empty :: AdjacencyMap a -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (Empty :: AdjacencyMap a -> Type) = 'AM (Eval (Empty :: MapC a (Set a) -> Type))
type Eval (Vertex a2 :: AdjacencyMap a1 -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (Vertex a2 :: AdjacencyMap a1 -> Type) = 'AM (Eval ((Singleton a2 :: Set a1 -> MapC a1 (Set a1) -> Type) =<< (Empty :: Set a1 -> Type)))
type Eval (ToAdjacencyMap x :: AdjacencyMap a -> Type) Source # 
Instance details

Defined in Fcf.Data.Graph

type Eval (Edge x y :: AdjacencyMap a -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (Edge x y :: AdjacencyMap a -> Type) = If (Eval (TyEq x y)) ('AM (Eval ((Singleton x :: Set a -> MapC a (Set a) -> Type) =<< Singleton y))) ('AM (Eval (FromList '['(x, Eval (Singleton y)), '(y, Eval (Empty :: Set a -> Type))])))
type Eval (Overlay ('AM x) ('AM y) :: AdjacencyMap a -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (Overlay ('AM x) ('AM y) :: AdjacencyMap a -> Type) = 'AM (Eval (UnionWith (Union :: Set a -> Set a -> Set a -> Type) x y))
type Eval (Connect ('AM x) ('AM y) :: AdjacencyMap a -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (Connect ('AM x) ('AM y) :: AdjacencyMap a -> Type) = 'AM (Eval (UnionsWith (Union :: Set a -> Set a -> Set a -> Type) '[x, y, Eval (FromSet (ConstFn (Eval (KeysSet y)) :: a -> Set a -> Type) (Eval (KeysSet x)))]))

data Empty :: Exp (AdjacencyMap a) Source #

Empty

Example

Expand
>>> :kind! (Eval Empty :: AdjacencyMap Nat)
(Eval Empty :: AdjacencyMap Nat) :: AdjacencyMap Nat
= 'AM ('MapC '[])

Instances

Instances details
type Eval (Empty :: AdjacencyMap a -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (Empty :: AdjacencyMap a -> Type) = 'AM (Eval (Empty :: MapC a (Set a) -> Type))

data Vertex :: a -> Exp (AdjacencyMap a) Source #

Vertex

Example

Expand
>>> :kind! (Eval (Vertex 1) :: AdjacencyMap Nat)
(Eval (Vertex 1) :: AdjacencyMap Nat) :: AdjacencyMap Nat
= 'AM ('MapC '[ '(1, 'S.Set '[])])

Instances

Instances details
type Eval (Vertex a2 :: AdjacencyMap a1 -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (Vertex a2 :: AdjacencyMap a1 -> Type) = 'AM (Eval ((Singleton a2 :: Set a1 -> MapC a1 (Set a1) -> Type) =<< (Empty :: Set a1 -> Type)))

data Edge :: a -> a -> Exp (AdjacencyMap a) Source #

Edge

Example

Expand
>>> :kind! (Eval (Edge 1 2) :: AdjacencyMap Nat)
(Eval (Edge 1 2) :: AdjacencyMap Nat) :: AdjacencyMap Nat
= 'AM ('MapC '[ '(1, 'S.Set '[2]), '(2, 'S.Set '[])])

Instances

Instances details
type Eval (Edge x y :: AdjacencyMap a -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (Edge x y :: AdjacencyMap a -> Type) = If (Eval (TyEq x y)) ('AM (Eval ((Singleton x :: Set a -> MapC a (Set a) -> Type) =<< Singleton y))) ('AM (Eval (FromList '['(x, Eval (Singleton y)), '(y, Eval (Empty :: Set a -> Type))])))

data Overlay :: AdjacencyMap a -> AdjacencyMap a -> Exp (AdjacencyMap a) Source #

Overlay

Example

Expand
>>> :kind! (Eval (Overlay (Eval (Vertex 1)) (Eval (Vertex 2))))
(Eval (Overlay (Eval (Vertex 1)) (Eval (Vertex 2)))) :: AdjacencyMap
                                                          Nat
= 'AM ('MapC '[ '(2, 'S.Set '[]), '(1, 'S.Set '[])])

Instances

Instances details
type Eval (Overlay ('AM x) ('AM y) :: AdjacencyMap a -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (Overlay ('AM x) ('AM y) :: AdjacencyMap a -> Type) = 'AM (Eval (UnionWith (Union :: Set a -> Set a -> Set a -> Type) x y))

data Connect :: AdjacencyMap a -> AdjacencyMap a -> Exp (AdjacencyMap a) Source #

Connect

Example

Expand
>>> :kind! (Eval (Connect (Eval (Vertex 1)) (Eval (Vertex 2))))
(Eval (Connect (Eval (Vertex 1)) (Eval (Vertex 2)))) :: AdjacencyMap
                                                          Nat
= 'AM ('MapC '[ '(1, 'S.Set '[2]), '(2, 'S.Set '[])])

Instances

Instances details
type Eval (Connect ('AM x) ('AM y) :: AdjacencyMap a -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (Connect ('AM x) ('AM y) :: AdjacencyMap a -> Type) = 'AM (Eval (UnionsWith (Union :: Set a -> Set a -> Set a -> Type) '[x, y, Eval (FromSet (ConstFn (Eval (KeysSet y)) :: a -> Set a -> Type) (Eval (KeysSet x)))]))

data IsEmpty :: AdjacencyMap a -> Exp Bool Source #

IsEmpty

Example

Expand
>>> :kind! (Eval (IsEmpty ('AM ('MapC '[]))))
(Eval (IsEmpty ('AM ('MapC '[])))) :: Bool
= 'True

Instances

Instances details
type Eval (IsEmpty ('AM x) :: Bool -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (IsEmpty ('AM x) :: Bool -> Type) = Eval (Null x)

data HasVertex :: a -> AdjacencyMap a -> Exp Bool Source #

HasVertex

Example

Expand
>>> :kind! (Eval (HasVertex 1 (Eval (Vertex 1))))
(Eval (HasVertex 1 (Eval (Vertex 1)))) :: Bool
= 'True

Instances

Instances details
type Eval (HasVertex x ('AM y) :: Bool -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (HasVertex x ('AM y) :: Bool -> Type) = Eval (Member x y)

data HasEdge :: a -> a -> AdjacencyMap a -> Exp Bool Source #

HasEdge

Example

Expand
>>> :kind! (Eval (HasEdge 1 2 (Eval (Edge 1 2))))
(Eval (HasEdge 1 2 (Eval (Edge 1 2)))) :: Bool
= 'True

Instances

Instances details
type Eval (HasEdge x y ('AM z) :: Bool -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (HasEdge x y ('AM z) :: Bool -> Type) = Eval (UnMaybe (Pure 'False) (Member y) =<< Lookup x z)

data VertexCount :: AdjacencyMap a -> Exp Nat Source #

VertexCount

Example

Expand
>>> :kind! (Eval (VertexCount (Eval (Edge 1 2))))
(Eval (VertexCount (Eval (Edge 1 2)))) :: Nat
= 2

Instances

Instances details
type Eval (VertexCount ('AM x) :: Nat -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (VertexCount ('AM x) :: Nat -> Type) = Eval (Size x)

data EdgeCount :: AdjacencyMap a -> Exp Nat Source #

EdgeCount

Example

Expand
>>> :kind! (Eval (EdgeCount (Eval (Edge 1 2))))
(Eval (EdgeCount (Eval (Edge 1 2)))) :: Nat
= 1

Instances

Instances details
type Eval (EdgeCount ('AM x) :: Nat -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (EdgeCount ('AM x) :: Nat -> Type) = Eval ((Foldr (+) 0 :: [Nat] -> Nat -> Type) =<< ((Map (Size :: Set v -> Nat -> Type) :: [Set v] -> [Nat] -> Type) =<< Elems x))

data VertexList :: AdjacencyMap a -> Exp [a] Source #

VertexList

Example

Expand
>>> :kind! (Eval (VertexList (Eval (Edge 1 2))))
(Eval (VertexList (Eval (Edge 1 2)))) :: [Nat]
= '[1, 2]

Instances

Instances details
type Eval (VertexList ('AM x) :: [k] -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (VertexList ('AM x) :: [k] -> Type) = Eval (Keys x)

data EdgeList :: AdjacencyMap a -> Exp [(a, a)] Source #

EdgeList

Example

Expand
>>> :kind! (Eval (EdgeList (Eval (Connect (Eval (Vertex 1)) (Eval (Connect (Eval (Vertex 2)) (Eval (Vertex 3))))))))
(Eval (EdgeList (Eval (Connect (Eval (Vertex 1)) (Eval (Connect (Eval (Vertex 2)) (Eval (Vertex 3)))))))) :: [(Nat,
                                                                                                               Nat)]
= '[ '(1, 2), '(1, 3), '(2, 3)]

Instances

Instances details
type Eval (EdgeList ('AM x) :: [(y, y)] -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (EdgeList ('AM x) :: [(y, y)] -> Type) = Eval ((EComb :: [(y, [y])] -> [(y, y)] -> Type) =<< ((Map (Second (ToList :: Set y -> [y] -> Type) :: (y, Set y) -> (y, [y]) -> Type) :: [(y, Set y)] -> [(y, [y])] -> Type) =<< ToList x))

data EComb :: [(x, [y])] -> Exp [(x, y)] Source #

Instances

Instances details
type Eval (EComb ('(x2, y2 ': ys) ': xs) :: [(x1, y1)] -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (EComb ('(x2, y2 ': ys) ': xs) :: [(x1, y1)] -> Type) = '(x2, y2) ': Eval (EComb ('(x2, ys) ': xs))
type Eval (EComb ('(_1, '[] :: [y]) ': xs) :: [(x, y)] -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (EComb ('(_1, '[] :: [y]) ': xs) :: [(x, y)] -> Type) = Eval (EComb xs)
type Eval (EComb ('[] :: [(x, [y])]) :: [(x, y)] -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (EComb ('[] :: [(x, [y])]) :: [(x, y)] -> Type) = '[] :: [(x, y)]

data VertexSet :: AdjacencyMap a -> Exp (Set a) Source #

VertexSet

Example

Expand
>>> :kind! (Eval (VertexSet (Eval (Edge 1 2))))
(Eval (VertexSet (Eval (Edge 1 2)))) :: S.Set Nat
= 'S.Set '[1, 2]

Instances

Instances details
type Eval (VertexSet ('AM xs) :: Set k -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (VertexSet ('AM xs) :: Set k -> Type) = Eval (KeysSet xs)

data EdgeSet :: AdjacencyMap a -> Exp (Set (a, a)) Source #

EdgeSet

Example

Expand
>>> :kind! (Eval (EdgeSet (Eval (Edge 1 2))))
(Eval (EdgeSet (Eval (Edge 1 2)))) :: S.Set (Nat, Nat)
= 'S.Set '[ '(1, 2)]

Instances

Instances details
type Eval (EdgeSet xs :: Set (a, a) -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (EdgeSet xs :: Set (a, a) -> Type) = Eval ((FromList :: [(a, a)] -> Set (a, a) -> Type) =<< EdgeList xs)

data AdjacencyList :: AdjacencyMap a -> Exp [(a, [a])] Source #

AdjacencyList

Example

Expand
>>> :kind! (Eval (AdjacencyList (Eval (Edge 1 2))))
(Eval (AdjacencyList (Eval (Edge 1 2)))) :: [(Nat, [Nat])]
= '[ '(1, '[2]), '(2, '[])]

Instances

Instances details
type Eval (AdjacencyList ('AM xs) :: [(v, [v])] -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (AdjacencyList ('AM xs) :: [(v, [v])] -> Type) = Eval ((Map (Map (ToList :: Set v -> [v] -> Type) :: (v, Set v) -> (v, [v]) -> Type) :: [(v, Set v)] -> [(v, [v])] -> Type) =<< ToList xs)

data UnionWith :: (v -> v -> Exp v) -> MapC k v -> MapC k v -> Exp (MapC k v) Source #

UnionWith

Example

Expand
>>> :kind! (Eval (UnionWith (++) (Eval (MapC.FromList ['(5, '["a"]), '(3, '["b"])])) (Eval (MapC.FromList ['(5, '["A"]), '(7, '["C"])]))))
(Eval (UnionWith (++) (Eval (MapC.FromList ['(5, '["a"]), '(3, '["b"])])) (Eval (MapC.FromList ['(5, '["A"]), '(7, '["C"])])))) :: MapC
                                                                                                                                     Nat
                                                                                                                                     [Symbol]
= 'MapC '[ '(5, '["a", "A"]), '(7, '["C"]), '(3, '["b"])]

Instances

Instances details
type Eval (UnionWith f ('MapC m1) m2 :: MapC k v -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (UnionWith f ('MapC m1) m2 :: MapC k v -> Type) = Eval (Foldr (UCombW f :: (k, v) -> MapC k v -> MapC k v -> Type) m2 m1)

data UCombW :: (v -> v -> Exp v) -> (k, v) -> MapC k v -> Exp (MapC k v) Source #

Instances

Instances details
type Eval (UCombW f '(k2, v2) lst :: MapC k1 v1 -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (UCombW f '(k2, v2) lst :: MapC k1 v1 -> Type) = Eval (InsertWith f k2 v2 lst)

data UnionsWith :: (v -> v -> Exp v) -> [MapC k v] -> Exp (MapC k v) Source #

UnionsWith

Example

Expand
>>> :kind! (Eval (UnionsWith (++) ['MapC ['(5, '["a"]), '(3, '["b"])], 'MapC ['(5, '["A"]), '(7, '["C"])], 'MapC ['(5, '["e"]), '(7, '["o"])]]))
(Eval (UnionsWith (++) ['MapC ['(5, '["a"]), '(3, '["b"])], 'MapC ['(5, '["A"]), '(7, '["C"])], 'MapC ['(5, '["e"]), '(7, '["o"])]])) :: MapC
                                                                                                                                           Nat
                                                                                                                                           [Symbol]
= 'MapC '[ '(7, '["C", "o"]), '(5, '["a", "A", "e"]), '(3, '["b"])]

Instances

Instances details
type Eval (UnionsWith f xs :: MapC k v -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (UnionsWith f xs :: MapC k v -> Type) = Eval (Foldr (UnionWith f :: MapC k v -> MapC k v -> MapC k v -> Type) (Eval (Empty :: MapC k v -> Type)) xs)

data FromSet :: (k -> Exp a) -> Set k -> Exp (MapC k a) Source #

FromSet

Example

Expand
>>> :kind! (Eval (FromSet ((+) 1) ('S.Set [1,2,3])))
(Eval (FromSet ((+) 1) ('S.Set [1,2,3]))) :: MapC Nat Nat
= 'MapC '[ '(1, 2), '(2, 3), '(3, 4)]

Instances

Instances details
type Eval (FromSet f ('Set xs) :: MapC k v -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (FromSet f ('Set xs) :: MapC k v -> Type) = Eval ((FromList :: [(k, v)] -> MapC k v -> Type) $ Eval (Map (ToSnd f) xs))

data ToFst :: (a -> Exp b) -> a -> Exp (b, a) Source #

ToFst

Example

Expand
>>> :kind! (Eval (ToFst Length ["f", "o", "o"]))
(Eval (ToFst Length ["f", "o", "o"])) :: (Nat, [Symbol])
= '(3, '["f", "o", "o"])

Instances

Instances details
type Eval (ToFst f x :: (k2, k1) -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (ToFst f x :: (k2, k1) -> Type) = '(Eval (f x), x)

data ToSnd :: (a -> Exp b) -> a -> Exp (a, b) Source #

ToSnd

Example

Expand
>>> :kind! (Eval (ToSnd Length ["f", "o", "o"]))
(Eval (ToSnd Length ["f", "o", "o"])) :: ([Symbol], Nat)
= '( '["f", "o", "o"], 3)

Instances

Instances details
type Eval (ToSnd f x :: (k1, k2) -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (ToSnd f x :: (k1, k2) -> Type) = '(x, Eval (f x))

data KeysSet :: MapC k a -> Exp (Set k) Source #

KeysSet

Example

Expand
>>> :kind! (Eval (KeysSet ('MapC ['(5, "f"), '(3, "o")])))
(Eval (KeysSet ('MapC ['(5, "f"), '(3, "o")]))) :: S.Set Nat
= 'S.Set '[5, 3]

Instances

Instances details
type Eval (KeysSet xs :: Set v1 -> Type) Source # 
Instance details

Defined in Fcf.Data.AdjacencyMap

type Eval (KeysSet xs :: Set v1 -> Type) = Eval ((FromList :: [v1] -> Set v1 -> Type) =<< Keys xs)