<div dir="auto">The sad part is seemingly it discards having an informative stack trace? </div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 9, 2021 at 10:16 AM Simon Peyton Jones via Libraries <<a href="mailto:libraries@haskell.org">libraries@haskell.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">|  If we indeed had something like<br>
|  <br>
|      head :: Partial => [a] -> a<br>
|  <br>
|  that would be both informative and fairly straightforward to explain to<br>
|  students, for example. (Even if it is not clear to me that a type class<br>
|  really is the right way to express partiality of functions: I always thought<br>
|  information about partiality ought to be tied to the function arrow.)<br>
<br>
OK -- that sounds promising.  It's what Richard suggested earlier, and sounds pretty good to me.<br>
<br>
Simon<br>
<br>
<br>
|  -----Original Message-----<br>
|  From: <a href="mailto:Henrik.Nilsson@nottingham.ac.uk" target="_blank">Henrik.Nilsson@nottingham.ac.uk</a> <<a href="mailto:Henrik.Nilsson@nottingham.ac.uk" target="_blank">Henrik.Nilsson@nottingham.ac.uk</a>><br>
|  Sent: 09 June 2021 14:45<br>
|  To: Simon Peyton Jones <<a href="mailto:simonpj@microsoft.com" target="_blank">simonpj@microsoft.com</a>>; Henrik Nilsson<br>
|  <<a href="mailto:Henrik.Nilsson@nottingham.ac.uk" target="_blank">Henrik.Nilsson@nottingham.ac.uk</a>>; <a href="mailto:libraries@haskell.org" target="_blank">libraries@haskell.org</a><br>
|  Subject: Re: RFC: Add HasCallStack constraint to partial Data.List<br>
|  functions.<br>
|  <br>
|   > I'm not sure I really agree with that.  There is a rich literature on  ><br>
|  effect systems, which decorate types with information about what  > effects<br>
|  the function has: exceptions, divergence, IO, and the like.<br>
|    > So type like<br>
|   >   head :: Partial => [a] -> a<br>
|   > where 'Partial =>' expresses the fact that calling this function  > might<br>
|  lead to a call of 'error' doesn't seem inherently something  > that doesn't<br>
|  belong in a type system.<br>
|  <br>
|  I, of course, agree that partiality is an effect. And I have no issues with<br>
|  effects being reflected in the type system.<br>
|  We do that all the time with e.g. monads.<br>
|  <br>
|  If we indeed had something like<br>
|  <br>
|      head :: Partial => [a] -> a<br>
|  <br>
|  that would be both informative and fairly straightforward to explain to<br>
|  students, for example. (Even if it is not clear to me that a type class<br>
|  really is the right way to express partiality of functions: I always thought<br>
|  information about partiality ought to be tied to the function arrow.)<br>
|  <br>
|  My point is that "HasCallStack" strongly suggest a specific approach to<br>
|  monitor the behaviour of a function in case it goes wrong.<br>
|  <br>
|  To me, at least, that is very operational.<br>
|  <br>
|  And I would struggle to explain<br>
|  <br>
|      head :: HasCallStack => [a] -> a<br>
|  <br>
|  beyond saying "it's just something that sometimes will help you with<br>
|  debugging", and deeply hoping no clever student would ask about the lack of<br>
|  similar annotations for other partial functions.<br>
|  <br>
|  Best,<br>
|  <br>
|  /Henrik<br>
|  <br>
|  <br>
|  <br>
|  This message and any attachment are intended solely for the addressee and<br>
|  may contain confidential information. If you have received this message in<br>
|  error, please contact the sender and delete the email and attachment.<br>
|  <br>
|  Any views or opinions expressed by the author of this email do not<br>
|  necessarily reflect the views of the University of Nottingham. Email<br>
|  communications with the University of Nottingham may be monitored where<br>
|  permitted by law.<br>
|  <br>
|  <br>
|  <br>
<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>