[Haskell-cafe] ANNOUNCE: mezzolens 0.0.0 & a puzzle
roconnor at theorem.ca
roconnor at theorem.ca
Sun Oct 11 23:11:15 UTC 2015
This is a pre-release of mezzolens, a library of first-order functional
references based purely on profunctors. I wrote it because
https://www.reddit.com/user/Faucelme asked for one. You can find it at
https://hackage.haskell.org/package/mezzolens
The main purpose of this pre-release is to provide background for framing
the following question:
In a pure profunctor lens libray, how do you write choosing and beside in
such a way that it supports all the following types?
choosing :: Lens ta tb a b -> Lens sa sb a b -> Lens (Either ta sa) (Either sa sb) a b
choosing :: Traversal ta tb a b -> Travesal sa sb a b -> Traversal (Either ta sa) (Either sa sb) a b
choosing :: SEC ta tb a b -> SEC sa sb a b -> SEC (Either ta sa) (Either sa sb) a b
beside :: Traversal ta tb a b -> Travesal sa sb a b -> Traversal (Either ta sa) (Either sa sb) a b
beside :: SEC ta tb a b -> SEC sa sb a b -> SEC (Either ta sa) (Either sa sb) a b
One sufficent solution for choosing would be to write a single function
that combines
lensVL :: (forall f. Functor f => (a -> f b) -> ta -> f tb) -> Lens ta tb a b
traversal :: (forall f. Applicative f => (a -> f b) -> ta -> f tb) -> Traversal ta tb a b
into one.
The obvious approach is to write an suitable adaptor that transforms any
(strong) profunctor into a functor, and if the profunctor is wandering, it
produces an applicative functor. But I haven't been able to devise such a
suitable adaptor.
--
Russell O'Connor <http://r6.ca/>
``All talk about `theft,''' the general counsel of the American Graphophone
Company wrote, ``is the merest claptrap, for there exists no property in
ideas musical, literary or artistic, except as defined by statute.''
More information about the Haskell-Cafe
mailing list