Module
Polyform.Dual
- Package
- purescript-polyform
- Repository
- purescript-polyform/polyform
#Dual Source
#DualD Source
data DualD p s i o o'Constructors
DualD (p i o') (o -> s i)
Instances
(Functor (p i)) => Functor (DualD p s i o)(Apply (p i), Applicative s, Semigroup i) => Apply (DualD p s i o')(Applicative (p i), Applicative s, Monoid i) => Applicative (DualD p s i o')(Alt (p i)) => Alt (DualD p s i o')(Plus (p i), Alt (p i), Monoid (s i)) => Plus (DualD p s i o')(Functor (p i)) => Profunctor (DualD p s i)(Lazy (p i o')) => Lazy (DualD p s i o o')
#diverge Source
diverge :: forall i o o' p s. Functor (p i) => Profunctor p => (o' -> o) -> Dual p s i o -> DualD p s i o' o#dual' Source
dual' :: forall i p s. Applicative s => p i i -> Dual p s i i#hoistParser Source
hoistParser :: forall i o p q s. ((p i) ~> (q i)) -> Dual p s i o -> Dual q s i o#hoistSerializer Source
hoistSerializer :: forall i o p s s'. (s ~> s') -> Dual p s i o -> Dual p s' i o#pureDual Source
pureDual :: forall i o p s. Applicative (p i) => Applicative s => Monoid i => o -> Dual p s i o#serializer Source
serializer :: forall i o p s. Dual p s i o -> (o -> s i)#(~) Source
Operator alias for Polyform.Dual.diverge (left-associative / precedence 5)
This function provides a way to diverge component serialization
from parsing so we are able to "divide for a moment o type" and
join them later by using Applicative composition.
Lets use the same symbol as in codecs for similar operation.
Quick example:
profile = Dual $ ( { email1: , email2: , age: } <$> .email1 ~ emailDual <*> _.email2 ~ emailDual <*> _.age ~ ageDual)
So in the above example we can turn let say Dual p String Email into
DualD p String { email1: Email } Email
using _.email1 ~ emailDual and apply + Dual from above example
"joins" these types again.
Of course these two steps can be handled by some generic layer.
- Modules
- Polyform
- Polyform.
Dual - Polyform.
Dual. Generic - Polyform.
Dual. Generic. Sum - Polyform.
Dual. Generic. Variant - Polyform.
Dual. Record - Polyform.
Dual. Variant - Polyform.
Exceptor - Polyform.
Parser - Polyform.
Reporter - Polyform.
Reporter. Dual - Polyform.
Reporter. Par - Polyform.
StarExceptT - Polyform.
Tokenized - Polyform.
Tokenized. Dual - Polyform.
Tokenized. Validator - Polyform.
Tokenized. Validator. Dual - Polyform.
Tokenized. Validator. Dual. Pure - Polyform.
Type. Row - Polyform.
Validator - Polyform.
Validator. Dual - Polyform.
Validator. Dual. Generic - Polyform.
Validator. Dual. Pure - Polyform.
Validator. Par - Polyform.
Validator. Pure - Polyform.
Validator. Record