In fact Unpickler is a Monad (isomorphic to an EitherT of a State) so "PU' a"
is an Applicative and PU is what I call a "product profunctor".
https://hackage.haskell.org/package/product-profunctors
This little augumentation in the definition of PU gets you a whole host of
free functionality from the libaries for profunctors, applicatives and
product profunctors.
(By the way, this observation is completely different from the "compiling
languages for different targets" technique that I mentioned in the previous
post.)
I did see that I could turn PU into a profunctor, but not that that would make it an Applicative. Huh. Thanks for the tip!
(I may have been distracted by looking for an arr to turn that profunctor into an arrow though.)
It seems that while the particular observation is quite different, the more general approach is similar. Which nicely brings us back to the original question: If something "almost" fits a class, there's probably a better one around the corner. One might just be blind right now.
Cheers,
MarLinn
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-caf e
Only members subscribed via the mailman list are allowed to post.