Module

Transit.StateGraph

Package
purescript-transit
Repository
m-bock/purescript-transit

Conversion of transit specifications to graph data structures.

This module provides functions to convert transit cores into graph representations, enabling graph-based analysis of state machines (e.g., finding paths, cycles, etc.).

#EdgeStateTransition Source

type EdgeStateTransition = { guard :: Maybe GuardName, msg :: MsgName }

Edge label type for state transitions in the graph.

Contains the message that triggers the transition and an optional guard condition name.

#StateNode Source

type StateNode = StateName

Node type for states in the graph.

#StateGraph Source

type StateGraph = Graph EdgeStateTransition StateNode

Graph representation of a state machine.

Nodes represent states, and edges represent transitions with their associated messages and optional guard conditions.

#mkStateGraph Source

mkStateGraph :: TransitCore -> StateGraph

Converts a transit core specification into a graph representation.

Each match in the transit core becomes one or more edges in the graph, with each return state creating a separate edge. Guard conditions are preserved in the edge labels.