You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The free Applicative transformers aren't exactly well documented, and I have no sense of the efficiency concerns, but this seems to be an obvious Church version:
newtypeApTfgb=ApT{getApT::forallh.
(Applicativeh)
=> (foralla.fa->ha)
-> (foralla.g (ha) ->ha)
->hb}instanceFunctor (ApTfg) wherefmap f (ApT x) =ApT$\p q -> f <$> x p q
instanceApplicativeg=>Applicative (ApTfg) wherepure x =ApT$\_ q -> q (pure (pure x))
ApT fs <*>ApT xs =ApT$\p q -> fs p q <*> xs p q
liftApT::fa->ApTfga
liftApT fa =ApT$\p _ -> p fa
liftApO::Functorg=>ga->ApTfga
liftApO ga =ApT$\_ q -> q $fmappure ga
runApT::Applicativeh=> (foralla.fa->ha) -> (foralla.g (ha) ->ha) ->ApTfgb->hb
runApT f g (ApT x) = x f g
hoistApT:: (foralla.fa->f'a) ->ApTfgb->ApTf'gb
hoistApT f (ApT x) =ApT$\p -> x (p . f)
transApT:: (foralla.ga->g'a) ->ApTfgb->ApTfg'b
transApT f (ApT x) =ApT$\p q -> x p (q . f)
By the way: it would be very nice to document the distinction between ApF and ApT.
The text was updated successfully, but these errors were encountered:
The free
Applicative
transformers aren't exactly well documented, and I have no sense of the efficiency concerns, but this seems to be an obvious Church version:By the way: it would be very nice to document the distinction between
ApF
andApT
.The text was updated successfully, but these errors were encountered: