Pointed and Traversable
Henning Thielemann
schlepptop at henning-thielemann.de
Mon Aug 26 18:59:58 CEST 2013
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?
More information about the Libraries
mailing list