| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Shrun.Configuration.Data.Graph
Synopsis
- data EdgeArgs
- newtype Edges = MkEdges {}
- sortEdges :: Edges -> Edges
- type Edge = (CommandIndex, CommandIndex, EdgeLabel)
- data EdgeSequential
- data EdgeLabel
- displayEdgeLabel :: IsString s => EdgeLabel -> s
- data CommandGraph = MkCommandGraph {}
- type Vertex = Int
- type LVertex a = (Vertex, a)
- mkGraph :: (HasCallStack, MonadThrow m) => EdgeArgs -> NESeq CommandP1 -> m CommandGraph
- mkEdgelessGraph :: NESeq CommandP1 -> CommandGraph
- labVertices :: CommandGraph -> [LVertex CommandP1]
- labVertex :: (HasCallStack, MonadEvaluate m) => CommandGraph -> Vertex -> m (LVertex CommandP1)
- labInVertices :: CommandGraph -> Vertex -> [(Vertex, EdgeLabel)]
- outVertices :: CommandGraph -> Vertex -> [Vertex]
- vertices :: CommandGraph -> [Vertex]
- context :: (HasCallStack, MonadEvaluate m) => CommandGraph -> Vertex -> m (Context CommandP1 EdgeLabel)
- ctxLabVertex :: Context a b -> LVertex a
- ctxOutVertices :: Context a b -> [Vertex]
Args
CLI command graph. The default instance is an "edgeless graph", in the sense that all commands are root nodes without any edges, hence normal behavior.
Constructors
| EdgeArgsSequential EdgeSequential | Sequential i.e. a linear graph of success edges. |
| EdgeArgsList Edges | Explicit edges. |
Dependency edges are supplied by the user on the CLI.
type Edge = (CommandIndex, CommandIndex, EdgeLabel) Source #
An edge between two indices.
data EdgeSequential Source #
Sequential options.
Constructors
| EdgeSequentialAnd | Sequential |
| EdgeSequentialOr | Sequential |
| EdgeSequentialAny | Sequential |
Instances
Types of edges.
Constructors
| EdgeAnd | cmd1 & cmd2 runs cmd2 iff cmd1 succeeds. |
| EdgeOr | cmd1 | cmd2 runs cmd2 iff cmd1 fails. |
| EdgeAny | cmd1 ; cmd2 runs cmd2 iff cmd1 finishes with any status. |
Instances
| NFData EdgeLabel Source # | |||||
Defined in Shrun.Configuration.Data.Graph | |||||
| Bounded EdgeLabel Source # | |||||
| Enum EdgeLabel Source # | |||||
Defined in Shrun.Configuration.Data.Graph Methods succ :: EdgeLabel -> EdgeLabel # pred :: EdgeLabel -> EdgeLabel # fromEnum :: EdgeLabel -> Int # enumFrom :: EdgeLabel -> [EdgeLabel] # enumFromThen :: EdgeLabel -> EdgeLabel -> [EdgeLabel] # enumFromTo :: EdgeLabel -> EdgeLabel -> [EdgeLabel] # enumFromThenTo :: EdgeLabel -> EdgeLabel -> EdgeLabel -> [EdgeLabel] # | |||||
| Generic EdgeLabel Source # | |||||
Defined in Shrun.Configuration.Data.Graph Associated Types
| |||||
| Show EdgeLabel Source # | |||||
| Eq EdgeLabel Source # | |||||
| Ord EdgeLabel Source # | |||||
| Hashable EdgeLabel Source # | |||||
| Pretty EdgeLabel Source # | |||||
| type Rep EdgeLabel Source # | |||||
Defined in Shrun.Configuration.Data.Graph type Rep EdgeLabel = D1 ('MetaData "EdgeLabel" "Shrun.Configuration.Data.Graph" "shrun-0.10-inplace" 'False) (C1 ('MetaCons "EdgeAnd" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "EdgeOr" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EdgeAny" 'PrefixI 'False) (U1 :: Type -> Type))) | |||||
displayEdgeLabel :: IsString s => EdgeLabel -> s Source #
Graph
data CommandGraph Source #
Command dependency graph. Morally, Vertex == CommandIndex.
Constructors
| MkCommandGraph | |
Instances
| Show CommandGraph Source # | |
Defined in Shrun.Configuration.Data.Graph Methods showsPrec :: Int -> CommandGraph -> ShowS # show :: CommandGraph -> String # showList :: [CommandGraph] -> ShowS # | |
| Eq CommandGraph Source # | |
Defined in Shrun.Configuration.Data.Graph | |
| Pretty CommandGraph Source # | |
Defined in Shrun.Configuration.Data.Graph | |
| (k ~ A_Lens, a ~ Gr CommandP1 EdgeLabel, b ~ Gr CommandP1 EdgeLabel) => LabelOptic "graph" k CommandGraph CommandGraph a b Source # | |
Defined in Shrun.Configuration.Data.Graph Methods labelOptic :: Optic k NoIx CommandGraph CommandGraph a b Source # | |
| (k ~ A_Lens, a ~ NESeq Vertex, b ~ NESeq Vertex) => LabelOptic "roots" k CommandGraph CommandGraph a b Source # | |
Defined in Shrun.Configuration.Data.Graph Methods labelOptic :: Optic k NoIx CommandGraph CommandGraph a b Source # | |
Creation
mkGraph :: (HasCallStack, MonadThrow m) => EdgeArgs -> NESeq CommandP1 -> m CommandGraph Source #
Creates a command dependency graph from list of dependencies and typed commands.
mkEdgelessGraph :: NESeq CommandP1 -> CommandGraph Source #
Creates a trivial command dep graph where each command is a
disconnected vertex, hence root. This exists to avoid the monad in
mkGraph, as some uses want purity (defaultConfig...).
We should have mkGraph mempty == mkEdgelessGraph.
Functions
labVertices :: CommandGraph -> [LVertex CommandP1] Source #
Retrieves all labeled vertices.
labVertex :: (HasCallStack, MonadEvaluate m) => CommandGraph -> Vertex -> m (LVertex CommandP1) Source #
Finds a labeled vertex. Can fail.
labInVertices :: CommandGraph -> Vertex -> [(Vertex, EdgeLabel)] Source #
Given a vertex d, returns all (s, l) s.t. there exists an l-edge s -> d.
outVertices :: CommandGraph -> Vertex -> [Vertex] Source #
Given a vertex s, returns all d s.t. there exists an edge s -> d.
vertices :: CommandGraph -> [Vertex] Source #
Retrieves all vertices.
Context
context :: (HasCallStack, MonadEvaluate m) => CommandGraph -> Vertex -> m (Context CommandP1 EdgeLabel) Source #
Given a vertex, retrieves its context.
ctxOutVertices :: Context a b -> [Vertex] Source #
outVertices that operates on the context.