Safe Haskell | None |
---|---|
Language | Haskell2010 |
Abstract operations on Maps containing graph edges.
- data TypeGraph
- typeInfo :: Lens' TypeGraph TypeInfo
- edges :: Lens' TypeGraph (GraphEdges TGV)
- graph :: Lens' TypeGraph (Graph, Vertex -> ((), TGV, [TGV]), TGV -> Maybe Vertex)
- gsimple :: Lens' TypeGraph (Graph, Vertex -> ((), TGVSimple, [TGVSimple]), TGVSimple -> Maybe Vertex)
- stack :: Lens' TypeGraph [StackElement]
- graphFromMap :: forall key. Ord key => GraphEdges key -> (Graph, Vertex -> ((), key, [key]), key -> Maybe Vertex)
- allLensKeys :: (DsMonad m, MonadReader TypeGraph m) => m (Map TGVSimple (Set TGV))
- allPathKeys :: (DsMonad m, MonadReader TypeGraph m) => m (Map TGVSimple (Set TGVSimple))
- allPathStarts :: forall m. (DsMonad m, MonadReader TypeGraph m) => m (Set TGV)
- reachableFrom :: forall m. (DsMonad m, MonadReader TypeGraph m) => TGV -> m (Set TGV)
- reachableFromSimple :: forall m. (DsMonad m, MonadReader TypeGraph m) => TGVSimple -> m (Set TGVSimple)
- goalReachableFull :: (Functor m, DsMonad m, MonadReader TypeGraph m) => TGV -> TGV -> m Bool
- goalReachableSimple :: (Functor m, DsMonad m, MonadReader TypeGraph m) => TGVSimple -> TGVSimple -> m Bool
- goalReachableSimple' :: (Functor m, DsMonad m, MonadReader TypeGraph m) => TGV -> TGV -> m Bool
- makeTypeGraph :: MonadReader TypeInfo m => GraphEdges TGV -> m TypeGraph
- data VertexStatus typ
- typeGraphEdges' :: forall m. (DsMonad m, MonadReader TypeGraph m, HasSet TGV m) => (TGV -> m (Set TGV)) -> [Type] -> m (GraphEdges TGV)
- adjacent :: forall m. (MonadReader TypeGraph m, DsMonad m) => TGV -> m (Set TGV)
- typeGraphVertex :: (MonadReader TypeGraph m, DsMonad m) => Type -> m TGV
- typeGraphVertexOfField :: (MonadReader TypeGraph m, DsMonad m) => (Name, Name, Either Int Name) -> Type -> m TGV
Documentation
gsimple :: Lens' TypeGraph (Graph, Vertex -> ((), TGVSimple, [TGVSimple]), TGVSimple -> Maybe Vertex) Source
graphFromMap :: forall key. Ord key => GraphEdges key -> (Graph, Vertex -> ((), key, [key]), key -> Maybe Vertex) Source
Build a graph from the result of typeGraphEdges, each edge goes from a type to one of the types it contains. Thus, each edge represents a primitive lens, and each path in the graph is a composition of lenses.
allLensKeys :: (DsMonad m, MonadReader TypeGraph m) => m (Map TGVSimple (Set TGV)) Source
Lenses represent steps in a path, but the start point is a type vertex and the endpoint is a field vertex.
allPathKeys :: (DsMonad m, MonadReader TypeGraph m) => m (Map TGVSimple (Set TGVSimple)) Source
Paths go between simple types.
allPathStarts :: forall m. (DsMonad m, MonadReader TypeGraph m) => m (Set TGV) Source
reachableFrom :: forall m. (DsMonad m, MonadReader TypeGraph m) => TGV -> m (Set TGV) Source
reachableFromSimple :: forall m. (DsMonad m, MonadReader TypeGraph m) => TGVSimple -> m (Set TGVSimple) Source
goalReachableFull :: (Functor m, DsMonad m, MonadReader TypeGraph m) => TGV -> TGV -> m Bool Source
Can we reach the goal type from the start type in this key?
goalReachableSimple :: (Functor m, DsMonad m, MonadReader TypeGraph m) => TGVSimple -> TGVSimple -> m Bool Source
goalReachableSimple' :: (Functor m, DsMonad m, MonadReader TypeGraph m) => TGV -> TGV -> m Bool Source
makeTypeGraph :: MonadReader TypeInfo m => GraphEdges TGV -> m TypeGraph Source
data VertexStatus typ Source
When a VertexStatus value is associated with a Type it describes alterations in the type graph from the usual default.
Vertex | normal case |
Sink | out degree zero - don't create any outgoing edges |
Divert typ | replace all outgoing edges with an edge to an alternate type |
Extra typ | add an extra outgoing edge to the given type |
Show typ => Show (VertexStatus typ) Source | |
Default (VertexStatus typ) Source |
:: (DsMonad m, MonadReader TypeGraph m, HasSet TGV m) | |
=> (TGV -> m (Set TGV)) | This function is applied to every expanded type before
use, and the result is used instead. If it returns
NoVertex, no vertices or edges are added to the graph.
If it returns Sink no outgoing edges are added. The
current use case Substitute is to see if there is an
instance of class |
-> [Type] | |
-> m (GraphEdges TGV) |
Return the set of edges implied by the subtype relationship among a set of types. This is just the nodes of the type graph. The type aliases are expanded by the th-desugar package to make them suitable for use as map keys.
adjacent :: forall m. (MonadReader TypeGraph m, DsMonad m) => TGV -> m (Set TGV) Source
Return the set of adjacent vertices according to the default type graph - i.e. the one determined only by the type definitions, not by any additional hinting function.
typeGraphVertex :: (MonadReader TypeGraph m, DsMonad m) => Type -> m TGV Source
Return the TGV associated with a particular type, with no field specified.