Discussion:
Resolve name collsion of `first` and `second` by Control.Arrow and Data.Bifunctor
Wolfgang Jeltsch
2018-05-09 12:59:46 UTC
Permalink
      In modern code it should be fairly rare to import
      Control.Arrow. 
      […] in an attempt to help lead people away from Control.Arrow.
I’m irritated. Can someone explain what is wrong about
Control.Arrow?
I think there is nothing wrong about Arrow, but people abused
Arrow.first and Arrow.second for plain function arrow and now we have
Bifunctor which is the more appropriate abstraction for most uses of
'first' and 'second'. (Though I guess that most uses need no
abstraction at all.)
I think using Bifunctor.first and Bifunctor.second is as much an abuse
as using Arrow.first and Arrow.second. When using Arrow you specialize
the arrow type to (->), but when using Bifunctor you specialize the
bifunctor type to (,).



All the best,
Wolfgang
Henning Thielemann
2018-05-18 07:13:23 UTC
Permalink
Post by Wolfgang Jeltsch
I think using Bifunctor.first and Bifunctor.second is as much an abuse
as using Arrow.first and Arrow.second. When using Arrow you specialize
the arrow type to (->), but when using Bifunctor you specialize the
bifunctor type to (,).
I actually use my own specialised mapFst and mapSnd functions from
utility-ht. I also found that I sometimes need strict versions of these
functions in order to prevent space leaks.

Loading...