Proposal: Add Foldable1 from 'semigroupoids' to base

Edward Kmett ekmett at gmail.com
Thu Jun 7 19:25:23 UTC 2018



Sent from my iPhone

> On Jun 7, 2018, at 9:14 PM, David Feuer <david.feuer at gmail.com> wrote:
> 
> I'd be much more interested in Traversable1. Why only propose Foldable1?

Merging Apply/Semiapplicative into base is a much bigger move as it is a step towards making it a superclass of Applicative, and that will AMP levels of code. You need it for Traversable1/Semitraversable to make sense.

On the other hand Semifoldable is a concept you can ignore until you start using semigroups more. The community has already paid the price for refactoring their monoids. This gives them some benefit they can reap from pain already borne.

-Edward

>> On Thu, Jun 7, 2018 at 3:12 PM, Daniel Cartwright <chessai1996 at gmail.com> wrote:
>> For those of you unfamiliar with 'Foldable1', it is a typeclass for nonempty
>> foldable structures, that centres around Semigroup instead of Monoid.
>> I have made a differential on Phabricator for the change here:
>> https://phabricator.haskell.org/D4812
>> 
>> Some discussion at the following links also:
>> 
>> https://ghc.haskell.org/trac/ghc/ticket/13573
>> 
>> https://www.reddit.com/r/haskell/comments/8p531d/ann_safefoldable_safe_wrappers_for_nullpartial/
>> 
>> https://github.com/ekmett/semigroupoids/issues/49
>> 
>> 
>> Note: foldl1 and foldr1 are currently typeclass methods of 'Foldable' and
>> not 'Foldable1', and even though I think they should be, they probably (and
>> shouldn't) be removed in this change, though I hope that eventually they can
>> be moved to Foldable1.
>> 
>> Foldable1 is also unfortunately named due to the suffix '1' being connotated
>> with the conventions surrounded Data.Functor.Classes (Show1, Eq1, etc.). If
>> this naming is seen as sufficiently unfortunate/confusing because of that,
>> then perhaps the name should be changed to something like 'SemiFoldable'.
>> The name change would most likely have to be made in 'semigroupoids' first
>> if that is the case.
>> 
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>> 
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries


More information about the Libraries mailing list