<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 8, 2021, 1:39 PM Richard Eisenberg <<a href="mailto:lists@richarde.dev">lists@richarde.dev</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space">I've been very much of two minds in this debate: On the one hand, having these constraints is very practically useful. On the other, what we're doing here is very un-Haskellish, in that we're letting operational concerns leak into a declarative property (a function's type).</div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Yes, this is quite awkward. We have here a tension:</div><div dir="auto"><br></div><div dir="auto">1. The *operational* type, indicating the calling convention. This includes HasCallStack.</div><div dir="auto"><br></div><div dir="auto">2. The "denotational" type (for want of a better term), indicating what users (generally) have to know about the function. This does not include HasCallStack.</div><div dir="auto"><br></div><div dir="auto">HasCallStack is already partially magical (and the rest is library internals). Maybe we should take that further, and remove HasCallStack from type signatures. Pardon my fake syntax:</div><div dir="auto"><br></div><div dir="auto">error :: forall {rep} (a :: TYPE rep). String -> a</div><div dir="auto">error @(_ :: class HasCallStack) msg = ...</div><div dir="auto"><br></div><div dir="auto">head :: [a] -> a</div><div dir="auto">head @(_ :: class HasCallStack) [] = error ...</div><div dir="auto"><br></div><div dir="auto">This has two downsides I see:</div><div dir="auto"><br></div><div dir="auto">1. It's no longer so easy to tell whether a function takes a call stack. But that's kind of the point; we usually don't want to think about that.</div><div dir="auto">2. It's no longer so obvious that undefined is a function. But ... we very rarely care that it is.</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>