RFC: Add HasCallStack constraint to partial Data.List functions.

Tom Ellis tom-lists-haskell-cafe-2017 at jaguarpaw.co.uk
Wed Jun 9 16:10:51 UTC 2021


I wonder if we can keep our nice separation of types being declarative
and terms being operational by augmenting Richard's proposed

    partialityIsOK :: String -> (Partial => r) -> r

with

    partialityIsOKWithCallStack :: String -> (Partial => r) -> r

Then it would become the call site's choice whether to ask for a call
stack rather than just unilaterally providing one whether the caller
wants it or not (which I believe is the current situation -- I admit I
don't understand HasCallStack).

Tom


On Wed, Jun 09, 2021 at 11:51:12AM -0400, Carter Schonwald wrote:
> The sad part is seemingly it discards having an informative stack trace?
> 
> On Wed, Jun 9, 2021 at 10:16 AM Simon Peyton Jones via Libraries <
> libraries at haskell.org> wrote:
> 
> > |  If we indeed had something like
> > |
> > |      head :: Partial => [a] -> a
> > |
> > |  that would be both informative and fairly straightforward to
> > |  explain to students, for example. (Even if it is not clear to
> > |  me that a type class really is the right way to express
> > |  partiality of functions: I always thought information about
> > |  partiality ought to be tied to the function arrow.)
> >
> > OK -- that sounds promising.  It's what Richard suggested earlier, and
> > sounds pretty good to me.


More information about the Libraries mailing list