Proposal: Add singleton function to Data.List module

Carter Schonwald carter.schonwald at gmail.com
Fri Aug 16 01:17:10 UTC 2019


Hard -1, , i'm not seeing a useful high impact payoff

plus its more verbose and adhoc than pure and more confusing than (:[])

I actually initially thought this thread was about Type Singletons and or
Proxy style apis using List as the term level form, it actually took me a
few minutes of reading everyone's replies to disambiguate

i'm open to changing my mind later if i can convince myself, but -1 for now

On Mon, Aug 12, 2019 at 3:53 PM Andrew Lelechenko <
andrew.lelechenko at gmail.com> wrote:

> - `pure`: Polymorphic, works for any `Functor`.
>
>
> It is OK to have polymorphic folds and length, so what is wrong with pure?
>
> Adding singleton to Data.List is a breaking change, when
> Data.Map.singleton was exported unqualified.
> And there is no singleton in Data.List.NonEmpty as well.
>
> -1 from me.
>
> Best regards,
> Andrew
>
> On 12 Aug 2019, at 19:36, Brent Yorgey <byorgey at gmail.com> wrote:
>
> At the risk of completely derailing the conversation, I have always called
> this the "robot monkey operator".  I fail to see what is so ninja-like
> about it.
>
> Anyway, I think I am +1 on adding Data.List.singleton.
>
> -Brent
>
> On Mon, Aug 12, 2019, 12:35 PM Zemyla <zemyla at gmail.com> wrote:
>
>> I also like the ninja-robot operator, because it's visually
>> interesting and easy to search for.
>>
>> Also, if you're importing several libraries which already use
>> "singleton", then you have to use "List.singleton" every time, which
>> is far uglier to me.
>>
>> On Mon, Aug 12, 2019 at 12:03 PM Herbert Valerio Riedel
>> <hvriedel at gmail.com> wrote:
>> >
>> > > - `(:[])`: Subjectively ugly.
>> >
>> > I consider "subjectively ugly" to be a non-technical and thus really
>> > weak argument to dismiss the list-idiomatic ninja-robot-operator (:[])
>> > which also happens to be shorter than the proposed alias for it. I for
>> > one don't see a significant benefit for adding a redundant synonym to
>> > `Data.List` and are thus -1 on this.
>> >
>> > > singleton :: a -> [a]
>> > > singleton x = [x]
>> > _______________________________________________
>> > 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
>>
> _______________________________________________
> 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/20190815/73dc5aa2/attachment.html>


More information about the Libraries mailing list