shrun
Safe HaskellNone
LanguageGHC2021

Shrun.Configuration.Data.Graph

Synopsis

Args

data EdgeArgs Source #

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.

Instances

Instances details
IsList EdgeArgs Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Associated Types

type Item EdgeArgs 
Instance details

Defined in Shrun.Configuration.Data.Graph

Show EdgeArgs Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Eq EdgeArgs Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Default EdgeArgs Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Methods

def :: EdgeArgs Source #

type Item EdgeArgs Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

newtype Edges Source #

Dependency edges are supplied by the user on the CLI.

Constructors

MkEdges 

Fields

Instances

Instances details
Monoid Edges Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Methods

mempty :: Edges #

mappend :: Edges -> Edges -> Edges #

mconcat :: [Edges] -> Edges #

Semigroup Edges Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Methods

(<>) :: Edges -> Edges -> Edges #

sconcat :: NonEmpty Edges -> Edges #

stimes :: Integral b => b -> Edges -> Edges #

IsList Edges Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Associated Types

type Item Edges 
Instance details

Defined in Shrun.Configuration.Data.Graph

Show Edges Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Methods

showsPrec :: Int -> Edges -> ShowS #

show :: Edges -> String #

showList :: [Edges] -> ShowS #

Eq Edges Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Methods

(==) :: Edges -> Edges -> Bool #

(/=) :: Edges -> Edges -> Bool #

(k ~ An_Iso, a ~ Seq Edge, b ~ Seq Edge) => LabelOptic "unEdges" k Edges Edges a b Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

type Item Edges Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

type Edge = (CommandIndex, CommandIndex, EdgeLabel) Source #

An edge between two indices.

data EdgeSequential Source #

Sequential options.

Constructors

EdgeSequentialAnd

Sequential and-edges.

EdgeSequentialOr

Sequential or-edges.

EdgeSequentialAny

Sequential any-edges.

Instances

Instances details
NFData EdgeSequential Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Methods

rnf :: EdgeSequential -> () #

Bounded EdgeSequential Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Enum EdgeSequential Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Generic EdgeSequential Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Associated Types

type Rep EdgeSequential 
Instance details

Defined in Shrun.Configuration.Data.Graph

type Rep EdgeSequential = D1 ('MetaData "EdgeSequential" "Shrun.Configuration.Data.Graph" "shrun-0.10-inplace" 'False) (C1 ('MetaCons "EdgeSequentialAnd" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "EdgeSequentialOr" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EdgeSequentialAny" 'PrefixI 'False) (U1 :: Type -> Type)))
Show EdgeSequential Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Eq EdgeSequential Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Ord EdgeSequential Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

type Rep EdgeSequential Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

type Rep EdgeSequential = D1 ('MetaData "EdgeSequential" "Shrun.Configuration.Data.Graph" "shrun-0.10-inplace" 'False) (C1 ('MetaCons "EdgeSequentialAnd" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "EdgeSequentialOr" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EdgeSequentialAny" 'PrefixI 'False) (U1 :: Type -> Type)))

data EdgeLabel Source #

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

Instances details
NFData EdgeLabel Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Methods

rnf :: EdgeLabel -> () #

Bounded EdgeLabel Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Enum EdgeLabel Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Generic EdgeLabel Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Associated Types

type Rep EdgeLabel 
Instance details

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)))
Show EdgeLabel Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Eq EdgeLabel Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Ord EdgeLabel Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Hashable EdgeLabel Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Pretty EdgeLabel Source # 
Instance details

Defined in Shrun.Configuration.Data.Graph

Methods

pretty :: EdgeLabel -> Doc ann Source #

prettyList :: [EdgeLabel] -> Doc ann Source #

type Rep EdgeLabel Source # 
Instance details

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)))

Graph

data CommandGraph Source #

Command dependency graph. Morally, Vertex == CommandIndex.

Constructors

MkCommandGraph 

Fields

type Vertex = Int Source #

Type for Command graph vertex, for usage with fgl.

type LVertex a = (Vertex, a) Source #

Labeled Vertex.

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.

ctxLabVertex :: Context a b -> LVertex a Source #

labVertex that operates on the context.

ctxOutVertices :: Context a b -> [Vertex] Source #

outVertices that operates on the context.