Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module provides instances of LabelOptic
to be
used in conjunction with the optics
package.
In particular, there are two kind of optics to access
different parts of a Term
:
- With
#field
you obtain the lens (that is, a getter and a setter) for the corresponding field in a record. - With
#choice
you obtain the prism for the desired choice in an enumeration. You can use thenreview
to construct a term with the value.
In addition, we provide a utility function record
to
build a record out of the inner values. We intend the
interface to be very simple, so this function is overloaded
to take tuples of different size, with as many components
as values in the schema type.
Synopsis
- record :: BuildRecord w sch args r => r -> Term w sch (DRecord name args)
- record1 :: BuildRecord1 w sch arg r => r -> Term w sch (DRecord name '[arg])
- enum :: forall (choiceName :: Symbol) choices w sch name. EnumLabel choices choiceName => Term w sch (DEnum name choices)
- _U0 :: forall w (sch :: Schema') x xs r. TypeLabel w sch x r => Prism' (NS (FieldValue w sch) (x ': xs)) r
- _Next :: forall w (sch :: Schema') x xs. Prism' (NS (FieldValue w sch) (x ': xs)) (NS (FieldValue w sch) xs)
- _U1 :: forall w (sch :: Schema') a b xs r. TypeLabel w sch b r => Prism' (NS (FieldValue w sch) (a ': (b ': xs))) r
- _U2 :: forall w (sch :: Schema') a b c xs r. TypeLabel w sch c r => Prism' (NS (FieldValue w sch) (a ': (b ': (c ': xs)))) r
- _U3 :: forall w (sch :: Schema') a b c d xs r. TypeLabel w sch d r => Prism' (NS (FieldValue w sch) (a ': (b ': (c ': (d ': xs))))) r
- module Optics.Core
Build a term
enum :: forall (choiceName :: Symbol) choices w sch name. EnumLabel choices choiceName => Term w sch (DEnum name choices) Source #
_U0 :: forall w (sch :: Schema') x xs r. TypeLabel w sch x r => Prism' (NS (FieldValue w sch) (x ': xs)) r Source #
_Next :: forall w (sch :: Schema') x xs. Prism' (NS (FieldValue w sch) (x ': xs)) (NS (FieldValue w sch) xs) Source #
_U1 :: forall w (sch :: Schema') a b xs r. TypeLabel w sch b r => Prism' (NS (FieldValue w sch) (a ': (b ': xs))) r Source #
_U2 :: forall w (sch :: Schema') a b c xs r. TypeLabel w sch c r => Prism' (NS (FieldValue w sch) (a ': (b ': (c ': xs)))) r Source #
_U3 :: forall w (sch :: Schema') a b c d xs r. TypeLabel w sch d r => Prism' (NS (FieldValue w sch) (a ': (b ': (c ': (d ': xs))))) r Source #
Re-exported for convenience.
module Optics.Core
Orphan instances
(EnumLabel choices choiceName, r ~ ()) => LabelOptic choiceName A_Prism (Term w sch (DEnum name choices :: TypeDefB Type typeName Symbol)) (Term w sch (DEnum name choices :: TypeDefB Type typeName Symbol)) r r Source # | |
(FieldLabel w sch args fieldName r, t ~ w r) => LabelOptic fieldName A_Lens (Term w sch (DRecord name args)) (Term w sch (DRecord name args)) t t Source # | |
FieldLabel Identity sch args fieldName r => LabelOptic fieldName A_Lens (Term Identity sch (DRecord name args)) (Term Identity sch (DRecord name args)) r r Source # | |