mapM and Control.Arrow

Dear cafe, consider the declaration mapM :: (SomeArrow a, Traversable t) => a b c -> a (t b) (t c) For the Arrow a = (->), the above mapM is just an over-constrained fmap, since Functor is a superclass of Traversable. For the arrow a = Kleisi m, the above mapM is the Control.Monad.mapM we know. Currently I fail to see how it could be defined with any of the existing sub-classes in Control.Arrow. One might say that fmap and mapM are on the same spectrum: If you specialize SomeArrow to (->) you can generalize Traversable to Functor, if you specialize Functor to Traversable you can generalize (->) to SomeArrow. Cheers, Olaf

It needs to be an ArrowChoice, not just an Arrow, but it can be done.
https://github.com/ekmett/profunctors/pull/40
On Mon, Jul 8, 2019, 15:37 Olaf Klinke
Dear cafe,
consider the declaration
mapM :: (SomeArrow a, Traversable t) => a b c -> a (t b) (t c)
For the Arrow a = (->), the above mapM is just an over-constrained fmap, since Functor is a superclass of Traversable. For the arrow a = Kleisi m, the above mapM is the Control.Monad.mapM we know. Currently I fail to see how it could be defined with any of the existing sub-classes in Control.Arrow.
One might say that fmap and mapM are on the same spectrum: If you specialize SomeArrow to (->) you can generalize Traversable to Functor, if you specialize Functor to Traversable you can generalize (->) to SomeArrow.
Cheers, Olaf _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.

Cool, thanks for the pointer. But why is it that whenever something mildly categorical pops into my head, Edward Kmett has already published a package containing it?
Olaf
Am 09.07.2019 um 01:07 schrieb Zemyla
It needs to be an ArrowChoice, not just an Arrow, but it can be done. https://github.com/ekmett/profunctors/pull/40
On Mon, Jul 8, 2019, 15:37 Olaf Klinke
wrote: Dear cafe, consider the declaration
mapM :: (SomeArrow a, Traversable t) => a b c -> a (t b) (t c)
For the Arrow a = (->), the above mapM is just an over-constrained fmap, since Functor is a superclass of Traversable. For the arrow a = Kleisi m, the above mapM is the Control.Monad.mapM we know. Currently I fail to see how it could be defined with any of the existing sub-classes in Control.Arrow.
One might say that fmap and mapM are on the same spectrum: If you specialize SomeArrow to (->) you can generalize Traversable to Functor, if you specialize Functor to Traversable you can generalize (->) to SomeArrow.
Cheers, Olaf _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.

Because that's what Edward Kmett does. If he didn't exist, the Haskell
community would have had to invent him.
On Tue, Jul 9, 2019, 15:04 Olaf Klinke
Cool, thanks for the pointer. But why is it that whenever something mildly categorical pops into my head, Edward Kmett has already published a package containing it?
Olaf
Am 09.07.2019 um 01:07 schrieb Zemyla
: It needs to be an ArrowChoice, not just an Arrow, but it can be done.
https://github.com/ekmett/profunctors/pull/40
On Mon, Jul 8, 2019, 15:37 Olaf Klinke
wrote: Dear cafe, consider the declaration
mapM :: (SomeArrow a, Traversable t) => a b c -> a (t b) (t c)
For the Arrow a = (->), the above mapM is just an over-constrained fmap,
since Functor is a superclass of Traversable. For the arrow a = Kleisi m, the above mapM is the Control.Monad.mapM we know. Currently I fail to see how it could be defined with any of the existing sub-classes in Control.Arrow.
One might say that fmap and mapM are on the same spectrum: If you
specialize SomeArrow to (->) you can generalize Traversable to Functor, if you specialize Functor to Traversable you can generalize (->) to SomeArrow.
Cheers, Olaf _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
participants (2)
-
Olaf Klinke
-
Zemyla