Module
Generic.Optic.Ctor
- Package
- purescript-generics-rep-optics
- Repository
- LiamGoodacre/purescript-generics-rep-optics
#noCtor Source
noCtor :: forall p s. Profunctor p => Generic s NoConstructors => p Void Void -> p s s
Iso from an empty type to Void.
#genericAbsurd Source
genericAbsurd :: forall a t. Generic t NoConstructors => t -> a
Absurd for any Generic data-type with no constructors.
#_Ctor' Source
_Ctor' :: forall rep p a s ctor. Profunctor p => Generic s rep => GenericCtor p ctor rep a => SProxy ctor -> p a a -> p s s
Prism into a specific constructor of a data-type. Requires the constructor name in a symbol.
Example:
data T = A Int | B
_A :: Prism' T Int
_A = _Ctor' (SProxy :: SProxy "A")
_B :: Prism' T Unit
_B = _Ctor' (SProxy :: SProxy "B")