commercialhaskell / rio

A standard library for Haskell
Other
835 stars 54 forks source link

Data.Witherable #176

Closed akhra closed 5 years ago

akhra commented 5 years ago

In a similar vein to #172: the witherable package provides typeclass-based implementations of catMaybes, mapMaybe and filter, as well as wither which is semantically fmap catMaybes . traverse. It has no dependencies not already present in Rio; and in contrast to concerns on #172, performance should be no worse and possibly better than low-hanging alternatives.

It is actively maintained and current in Stackage. Its immediate Hackage reverse dependency list is short, but notably includes reflex. I haven't seen any competing conceptualizations (though I haven't looked hard for them either).

The big advantage of adopting this here is having generalized versions of these functions in the prelude, with no need for import qualification or hiding.

snoyberg commented 5 years ago

I'm overall -1 here. I tried the route of using lots of non-standard typeclasses in a prelude with classy-prelude. rio is explicitly about taking standard approaches, and Witherable doesn't seem to be well accepted right now. This can introduce some confusing error messages for people.

akhra commented 5 years ago

rio is explicitly about taking standard approaches, Witherable doesn't seem to be well accepted right now.

Fair enough -- I was leaning on "non-controversial" but I see the value of a higher adoption bar. Closing for now, if Witherable gathers momentum I might re-open later.