<div dir="ltr">I don't want to drag out bikeshedding either. But I *do* want to point out that mono-traversable also includes a function unsafeHead, separate from headEx. While headEx guarantees that it will throw an exception in the case of an empty Foldable, unsafeHead may crash your program. This is the same kind of distinction as vector and bytestring make between head and unsafeHead.</div>

<div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Feb 9, 2014 at 6:41 PM, Antoine Latter <span dir="ltr"><<a href="mailto:aslatter@gmail.com" target="_blank">aslatter@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Not that it matters, but I think I prefer the "Unsafe" suffix. I'm not calling this version of "head" because I *want* an exception - I'm calling it because I want "Unsafe" (non-typechecked) behavior - I'm asserting that I've already validated some preconditions that aren't reflected in the type.<br>



<br></div>But on the other hand I've always found functions like "fromMaybe" easier to work with than functions like "fromJust".<br><br></div>Enough bikeshedding! If it works in your packages that's fine, and these are the sort of functions I have no complaints about reimplementing on my own.<br>



</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Feb 8, 2014 at 11:25 PM, Michael Snoyman <span dir="ltr"><<a href="mailto:michael@snoyman.com" target="_blank">michael@snoyman.com</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">It means "throws an <b>ex</b>ception."</div><div><div><div class="gmail_extra">

<br><br><div class="gmail_quote">On Sun, Feb 9, 2014 at 5:04 AM, Antoine Latter <span dir="ltr"><<a href="mailto:aslatter@gmail.com" target="_blank">aslatter@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">What does "Ex" mean?<br></div><div><div><div class="gmail_extra"><br>

<br><div class="gmail_quote">On Thu, Feb 6, 2014 at 8:59 PM, Michael Snoyman <span dir="ltr"><<a href="mailto:michael@snoyman.com" target="_blank">michael@snoyman.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks for the input. We ended up going with an `Ex` suffix, e.g. headEx, lastEx.</div><div>

<div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 7, 2014 at 4:53 AM, Tikhon Jelvis <span dir="ltr"><<a href="mailto:tikhon@jelv.is" target="_blank">tikhon@jelv.is</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>For what it's worth, OCaml's Core library does this with _exn, so they would call a partial last "last_exn". I would actually prefer an abbreviation of some sort (like exn) as long as it's a consistent convention. Using a full word like "exception" or "partial" adds to much noise in my opinion, especially if the base name (like "last") is shorter than the suffix!<br>










<br></div>Also, I think a suffix would be better than a prefix, if only to group things conveniently when sorted alphabetically.<br></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">

On Thu, Jan 30, 2014 at 9:36 AM, Atze van der Ploeg <span dir="ltr"><<a href="mailto:atzeus@gmail.com" target="_blank">atzeus@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">unprovenLast ?</p>
<div class="gmail_quote"><div><div>On Jan 30, 2014 6:33 PM, "Michael Snoyman" <<a href="mailto:michael@snoyman.com" target="_blank">michael@snoyman.com</a>> wrote:<br type="attribution"></div></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
<div dir="ltr">Greg Weber and I have been discussing some changes to mono-traversable[1]. One of the modules we provide is Data.NonNull, which provides total versions of functions like `last`. A change we're looking at would require having a partial version of `last` defined in a separate typeclass (IsSequence), which would allowing for more optimized implementations of the total `last` function for datatypes which support it (e.g., strict ByteStrings).<div>














<br></div><div>But what should we name it? I'm sure everyone's familiar with the `unsafe` naming convention, but that's not appropriate here: standard usage shows `unsafe` meaning a function which can cause a segfault.</div>














<div><br></div><div>I initially named it `partialLast`, but partial can also imply partial function application. Greg brought up the idea of suffixing the function with something like `Throws` or `Errors`, which I think I'm a bit partial to myself[2].</div>














<div><br></div><div>So my questions are:</div><div><br></div><div>* Is there some already used naming scheme out there for partial functions which I've missed?</div><div>* Do people have any ideas to throw into the mix?</div>














<div><br></div><div>Michael<br><div><br></div><div>[1] <a href="https://github.com/snoyberg/mono-traversable/pull/21" target="_blank">https://github.com/snoyberg/mono-traversable/pull/21</a></div></div><div>[2] Pardon the pun.</div>













</div>
<br></div></div>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>