<div dir="ltr">> <span style="font-size:12.8px">What I'd suggest instead is to define your own undefined in a</span><br style="font-size:12.8px"><span style="font-size:12.8px">> Prelude-replacement (or simplification if you will). </span><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">No. Part of the reason for the book is so that people can learn in the environment that they'll use and be equipped to apply what they've learned with minimal surprises. This solution is worse than the others suggested so far. And _again_, it's not just about our book it's about learning resources more generally and what that experience is like for new people.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Rust doesn't need to have a beginner's Prelude. Idris doesn't either. In fact, most languages don't and the only one that has pulled it off convincingly is Racket which had less cause to do so than GHC does at this juncture.</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 13, 2016 at 6:02 PM, Eric Seidel <span dir="ltr"><<a href="mailto:eric@seidel.io" target="_blank">eric@seidel.io</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
On Sat, Feb 13, 2016, at 15:32, Christopher Allen wrote:<br>
> There's another problem I discovered with HasCallStack. The implicit<br>
> parameter constraint breaks sharing behavior for examples that use<br>
> bottom.<br>
<br>
</span>This is a necessary consequence of the implementation of callstack-aware<br>
functions as overloaded functions. It's really no different from using a<br>
type-class, and is in my opinion the correct behavior.<br>
<br>
It seems what you really want is a way to prevent GHC from inferring the<br>
HasCallStack constraint in the first place. That's doable with an<br>
explicit type signature (or even a combinator to wrap the expression),<br>
but this isn't a great solution for your book.<br>
<br>
What I'd suggest instead is to define your own undefined in a<br>
Prelude-replacement (or simplification if you will). Something like<br>
<br>
undefined :: a<br>
undefined = withFrozenCallStack emptyCallStack Prelude.undefined<br>
<br>
should work to remove all traces of CallStacks (including when it blows<br>
up). error can be similarly wrapped to avoid having to deal with<br>
CallStacks, and $ and the FTP-related functions can be specialized to<br>
less-polymorphic versions that are easier to explain to beginners (at<br>
least until they're ready to be exposed to the real versions).<br>
<br>
I'm sorry that this change has caused you trouble.<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr">Chris Allen<br><div><span style="font-size:12.8000001907349px">Currently working on </span><a href="http://haskellbook.com" target="_blank">http://haskellbook.com</a></div></div></div></div></div></div>
</div>