Add Data.Foldable1 to base

John Cotton Ericson John.Ericson at Obsidian.Systems
Tue Oct 22 14:51:09 UTC 2019


Echoing Keith's point, "semi" to me means a weaker algebra; i.e. a 
super-class. Foldable => Semifoldable is thus totally wrong, 
"Semifoldable" is the sub-class. In particular. The Monoid and Semigroup 
constraints on their respective methods further show that the fold class 
hierarchy is *contravariant* with respect to the binary operator class 
hierarchy. Putting semi-* with semi-* only makes sense for something 
covariant (e.g. the if methods *returned* `Dict (Semigroup a)` etc).

Semimonad and Semiapplicative are fine with me (I don't really care, not 
worth fighting one way or the other) but strong -1 on Semifoldable.

John

On 10/18/19 12:10 PM, Oleg Grenrus wrote:

> Please reply to the "Add Data.Foldable1 to base" -thread to keep the 
> discussion in one place.
> Otherwise this opinion will most likely be ignored.
>
> - Oleg
>
> P.S. That said, foldMap1/semifoldMap/... can fold over *less* things. 
> It can fold over NonEmpty (list) but not over ordinary [].
>
> On 18.10.2019 18.40, Keith wrote:
>> Sorry about bikeshedding. However, 'semifoldable' would be super 
>> confusing.
>>
>> If somebody saw 'semifoldMap' in the wild what would they think? 
>> Probably not that it can fold _more_ things than 'foldMap'.
>>
>> 'NonemptyFoldable', 'Semigroup.Foldable', 'SemigroupFoldable', and 
>> 'Foldable1', with 'sfoldMap', 'sgFoldMap', 'nonemptyFoldMap', or 
>> 'Semigroup.foldMap' may be long or meaningless to most, but at least 
>> they aren't actively misleading.
>>
>> –Keith
>>
>> On October 18, 2019 2:13:51 PM UTC, Oleg Grenrus 
>> <oleg.grenrus at iki.fi> wrote:
>>
>>     Relating to Foldable1/NonEmptyFoldable, based in another discussion (in
>>     my foldable1 to base proposal), it looks like it might be called
>>     Semifoldable
>>
>>     Seehttps://mail.haskell.org/pipermail/libraries/2019-October/030030.html
>>
>>     Yet, Semiset is different thing (based on wikipedia:
>>     https://en.wikipedia.org/wiki/Semiset).  NonEmptySet is a good name, it
>>     doesn't need explanation. If someone feels that it's too long, they can
>>     introduce `type NESet = NonEmptySet` alias in their development.
>>
>>     - Oleg
>>
>>     On 20.9.2019 4.56, Ruben Astudillo wrote:
>>
>>         On 19-09-19 22:17, Alexandre Esteves wrote:
>>
>>             I do like the sound of `instance Foldable1 Set1` more
>>             than I do `instance NonEmptyFoldable NonEmptySet`
>>             <https://hackage.haskell.org/package/semigroupoids-5.3.3/docs/Data-Semigroup-Foldable.html#t:Foldable1>
>>
>>
>>         I prefer it too, I just wish (future) documentation included
>>         a little explanation on why the suffix 1 was put. 
>>
>>     ------------------------------------------------------------------------
>>     Libraries mailing list
>>     Libraries at haskell.org
>>     http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>>
>>
>> -- 
>> Sent from my phone with K-9 Mail.
>>
>> _______________________________________________
>> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20191022/d8e85674/attachment.html>


More information about the Libraries mailing list