Module
Transit.VariantUtils
- Package
- purescript-transit
- Repository
- m-bock/purescript-transit
Convenience utilities for creating Variant values.
This module provides a type-safe way to create Variant values using type application, eliminating the need for Proxy values and allowing empty record arguments to be omitted.
Usage
For variants with empty payloads (empty record):
v @"DoorOpen" :: State
For variants with non-empty payloads:
v @"DoorLocked" { activePin: "1234" } :: State
#Inj Source
class Inj :: Symbol -> Type -> Constraintclass Inj (sym :: Symbol) a where
Type class for injecting values into Variants using type application.
The v function provides a convenient way to create Variant values
without needing Proxy values. It automatically handles both empty
and non-empty payloads.
Members
v :: a
Instances
- 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
Creates a Variant value by injecting a value into the specified variant label.
For variants with non-empty payloads, the payload must be provided:
For variants with empty payloads (empty record), the payload can be omitted: