Module
Transit.Class.CheckReturn
- Package
- purescript-transit
- Repository
- m-bock/purescript-transit
Type classes for checking and expanding partial return types to full state types.
#CheckReturn Source
class CheckReturn :: List' @Type ReturnTL -> Row Type -> Row Type -> Constraintclass CheckReturn (returns :: List' ReturnTL) (rowIn :: Row Type) (rowOut :: Row Type) | returns -> rowIn rowOut where
Checks and expands return types by removing Ret and RetVia wrappers from variant types.
The functional dependency returns -> rowIn rowOut ensures that given the
return list, both input and output row types are uniquely determined.
returns: List of return type-level specificationsrowIn: Input row type (with wrappers)rowOut: Output row type (without wrappers)
Members
checkReturn :: Variant rowIn -> Variant rowOut
Instances
CheckReturn Nil' () ()(Cons symState payload rowOut' rowOut, Cons symState (Ret payload) rowIn' rowIn, CheckReturn rest rowIn' rowOut', IsSymbol symState, Union rowOut' rowExtra rowOut) => CheckReturn (Cons' (MkReturnTL symState) rest) rowIn rowOut(Cons symState payload rowOut' rowOut, Cons symState (RetVia symGuard payload) rowIn' rowIn, CheckReturn rest rowIn' rowOut', IsSymbol symState, Union rowOut' rowExtra rowOut) => CheckReturn (Cons' (MkReturnViaTL symGuard symState) rest) rowIn rowOut
#checkReturnFast Source
checkReturnFast :: forall @returns state msg m rowIn rowOut. CheckReturn returns rowIn rowOut => (state -> msg -> m (Variant rowIn)) -> (state -> msg -> m (Variant rowOut))A faster version of checkReturn that uses unsafe coercion.
This is useful for performance-critical code where code generated by the compiler is a bottleneck.
It is safe because we guarantee that the runtime representation of the handler function is the same as the type-level representation.
- 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