Transit.Core
- Package
- purescript-transit
- Repository
- m-bock/purescript-transit
Core types and functions for transit specifications.
This module provides the foundational types for representing state machine specifications at both the type level and value level. It includes:
- Type-level constructors for building transit specifications
- Runtime reflection of type-level specifications to values
- Core data types for matches, returns, and transit cores
- Utility functions for querying transit specifications
#Match Source
data MatchA match represents a transition from a state triggered by a message.
- First
StateName: Source state name - Second
MsgName: Message name Array Return: Possible return states (may include guards)
Constructors
Instances
Show MatchEq MatchGeneric Match _(IsSymbol stateName, IsSymbol msgName) => Reflectable (MkMatchTL stateName msgName Nil') Match(IsSymbol stateName, IsSymbol msgName, Reflectable (MkMatchTL stateName msgName returns) Match, Reflectable ret Return) => Reflectable (MkMatchTL stateName msgName (Cons' ret returns)) Match
#MatchImpl Source
newtype MatchImpl :: Symbol -> Symbol -> Type -> Type -> (Type -> Type) -> Type -> Typenewtype MatchImpl (symStateIn :: Symbol) (symMsgIn :: Symbol) stateIn msgIn (m :: Type -> Type) stateOut
Type for match implementations in the update function builder.
Constructors
MatchImpl (stateIn -> msgIn -> m stateOut)
Instances
#MkMatchTL Source
data MkMatchTL :: StateNameTL -> MsgNameTL -> List' ReturnTL -> MatchTLdata MkMatchTL t0 t1 t2
Constructs a type-level match from a state name, message name, and list of returns.
Instances
(IsSymbol stateName, IsSymbol msgName) => Reflectable (MkMatchTL stateName msgName Nil') Match(IsSymbol stateName, IsSymbol msgName, Reflectable (MkMatchTL stateName msgName returns) Match, Reflectable ret Return) => Reflectable (MkMatchTL stateName msgName (Cons' ret returns)) Match
#MkReturnTL Source
data MkReturnTL :: StateNameTL -> ReturnTLdata MkReturnTL t0
Constructs a type-level return to a state (no guard).
Instances
(IsSymbol stateName) => Reflectable (MkReturnTL stateName) Return
#MkReturnViaTL Source
data MkReturnViaTL :: GuardNameTL -> StateNameTL -> ReturnTLdata MkReturnViaTL t0 t1
Constructs a type-level return via a guard to a state.
Instances
(IsSymbol guardName, IsSymbol stateName) => Reflectable (MkReturnViaTL guardName stateName) Return
#MkTransitCoreTL Source
data MkTransitCoreTL :: List' MatchTL -> TransitCoreTLdata MkTransitCoreTL t0
Constructs a type-level transit core from a list of matches.
Instances
Reflectable (MkTransitCoreTL Nil') TransitCore(Reflectable (MkTransitCoreTL transitions) TransitCore, Reflectable transition Match) => Reflectable (MkTransitCoreTL (Cons' transition transitions)) TransitCoreIsTransitSpec (MkTransitCoreTL xs) (MkTransitCoreTL xs)
#Return Source
data ReturnA return specification indicating the next state after a transition.
Return stateName: Direct transition to a stateReturnVia guardName stateName: Conditional transition via a guard
Constructors
Instances
Show ReturnEq ReturnGeneric Return _(IsSymbol stateName) => Reflectable (MkReturnTL stateName) Return(IsSymbol guardName, IsSymbol stateName) => Reflectable (MkReturnViaTL guardName stateName) Return
#TransitCore Source
newtype TransitCoreA transit core containing all matches (transitions) in a state machine.
Constructors
Instances
Show TransitCoreEq TransitCoreGeneric TransitCore _Reflectable (MkTransitCoreTL Nil') TransitCore(Reflectable (MkTransitCoreTL transitions) TransitCore, Reflectable transition Match) => Reflectable (MkTransitCoreTL (Cons' transition transitions)) TransitCore
#TransitCoreTL Source
data TransitCoreTLType-level representation of a transit core specification.
#IsTransitSpec Source
class IsTransitSpec :: forall spec. spec -> TransitCoreTL -> Constraintclass IsTransitSpec spec core | spec -> core
Type class that identifies a type as a valid transit specification.
Instances
IsTransitSpec (MkTransitCoreTL xs) (MkTransitCoreTL xs)
#getMatchesForState Source
getMatchesForState :: StateName -> TransitCore -> Array MatchGets all matches (transitions) that originate from a given state.
Returns an array of all matches where the source state matches the provided state name.
#getStateNames Source
getStateNames :: TransitCore -> Array StateNameExtracts all unique state names from a transit core.
Returns all states that appear as either source states or target states in any match, with duplicates removed.
- Modules
- Transit
- Transit.
Class. CheckReturn - Transit.
Class. CurryN - Transit.
Class. MkHandlerLookup - Transit.
Class. MkUpdate - Transit.
Core - Transit.
DSL - Transit.
Data. DotLang - Transit.
Data. Graph - Transit.
Data. Html - Transit.
Data. MaybeChurch - Transit.
Data. Table - Transit.
HandlerLookup - Transit.
Render. Graphviz - Transit.
Render. Theme - Transit.
Render. TransitionTable - Transit.
StateGraph - Transit.
VariantUtils