<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div dir="ltr"></div><div dir="ltr">I want to echo everything Matt Parsons is saying. I also want to publicly thank him for participating in this discussion and for making solid arguments. Thanks, Matt!</div><div dir="ltr"><br></div><div dir="ltr">By way of explanation, I was motivated to propose this addition because a member of my team wondered aloud if there was a function to do this. I told them that I didn’t know of one, but I typically used `pure` in point-free expressions and `[x]` when the value had already been named. We searched around and couldn’t find anything:</div><div dir="ltr"><br></div><div dir="ltr">- <a href="https://www.stackage.org/lts-14.0/hoogle?q=a+-%3E+%5Ba%5D">https://www.stackage.org/lts-14.0/hoogle?q=a+-%3E+%5Ba%5D</a></div><div dir="ltr">- <a href="https://hoogle.haskell.org/?hoogle=a%20-%3E%20%5Ba%5D">https://hoogle.haskell.org/?hoogle=a%20-%3E%20%5Ba%5D</a></div><div dir="ltr"><br></div><div dir="ltr">We got to talking about other ways to express the same thing. (Everything we came up with has been seen in this thread already.) That got me wondering why there *wasn’t* a specific, monomorphic function for this. The omission seemed especially strange to my team member because they were familiar with Elm, which has this function. </div><div dir="ltr"><br></div><div dir="ltr">All that to say: This proposal is motivated by real confusion coming from a junior developer using Haskell at work. Consider how easy it is to discover and do something, rather than if it’s technically possible. </div><div dir="ltr"><br>On Aug 13, 2019, at 7:20 PM, Matt <<a href="mailto:parsonsmatt@gmail.com">parsonsmatt@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div dir="ltr"><div dir="ltr">`(\x -> [x])` has the same polymorphism problem in the context of `OverloadedLists` as `pure`.<div><br></div><div>`(:[])` is also unsatisfactory. To parse it properly, you need to:</div><div><br></div><div>- Know that `:` is only allowed as an operator to prefix data constructors,</div><div>- Know that `[]` are not legal operator characters,</div><div>- Infer that you're intended to insert a space between the `:` and `[]` to get `(: [])`</div><div>- Recognize it as an operator section being used prefix as a normal function</div><div><br>I'm neither an expert nor a lifelong Haskeller, but I have been writing it in some professional capacity for four years now, and the operator section trips me up. I can't imagine less experienced folks find it easy or intuitive. You can't even search for it on hoogle: <a href="https://hoogle.haskell.org/?hoogle=(%3A%5B%5D)">https://hoogle.haskell.org/?hoogle=(%3A%5B%5D)</a></div><div><br></div><div>Is `(:[])` a core idiom? I never see it in work code and I've never seen it in Hackage. To check, I grepped my software directory which has all my Haskell code, and got 122 matches of (:[]) over 1,768,231 loc (as given by wc -l **/*.hs).</div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Matt Parsons</div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 13, 2019 at 4:56 PM Herbert Valerio Riedel <<a href="mailto:hvriedel@gmail.com">hvriedel@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> The point is to create a monomorphic variant [...]<br>
<br>
But we already have at least two monomorphic variants to express this<br>
with Haskell's concise native syntax and vocabulary which has by<br>
design a preferential treatment of lists (it was considered even more<br>
important than type-sigs so that we got the `:` cons operator for<br>
lists and the `::` for type-sig annotations) -- so let's not try to<br>
fight Haskell's core idioms by hiding them behind some trivial<br>
additional redundant synonyms! I still fail to see the actual<br>
*technical* problem being solved by the original proposal asking to<br>
add yet another, wordy way to construct single-item-lists.<br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div>
</div></blockquote><blockquote type="cite"><div dir="ltr"><span>_______________________________________________</span><br><span>Libraries mailing list</span><br><span><a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a></span><br><span><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a></span><br></div></blockquote></body></html>