
What are some example data types which have a "pure" which obeys this law,
but no corresponding law-abiding "ap"? The only compelling reason to split
it off is if the separation of abstractions will give us the power to reuse
code which was previously not as reusable.
-- Dan Burton
On Mon, Aug 26, 2013 at 10:16 AM, Edward Kmett
There are several uses of Pointed as a separate beast from Applicative. In particular it comes up when we talk about "affine traversals", and would let us refine the type hierarchy of lens, so you'd think I'd be for it.
However, to move it into its own class would require literally everyone who currently has an Applicative instance to clutter their code with CPPs.
Even as the author of the Pointed class, I personally find that the benefit of the change doesn't warrant the impact of the change.
-Edward
On Mon, Aug 26, 2013 at 12:59 PM, Henning Thielemann < schlepptop@henning-thielemann.de> wrote:
There was a lot of discussion about separating "pure" from Applicative and putting it into a Pointed class. If I remember correctly, the main counter argument was that 'pure' alone does not satisfy interesting laws. There are only such laws in connection with the Applicative class.
Now, in some situations I liked to have a generalized unfoldr. I can build this from "pure" and "sequenceA" using the State monad:
unfoldr :: (Pointed t, Traversable t) => (s -> (a, s)) -> s -> t a unfoldr = evalState . sequenceA . pure . state
One could state a law like:
traverse f (pure a) == traverse id (pure (f a))
Would this justify to move "pure" into a new Pointed class?
______________________________**_________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/**mailman/listinfo/librarieshttp://www.haskell.org/mailman/listinfo/libraries
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries