<p dir="ltr">"What's a call stack?"</p>
<p dir="ltr">(I don't know what Chris' target audience is though)</p>
<br><div class="gmail_quote"><div dir="ltr">On Sat, 13 Feb 2016 5:18 pm Eric Seidel <<a href="mailto:eric@seidel.io">eric@seidel.io</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Here's what the GHCi session should look like.<br>
<br>
> $ ghci<br>
> GHCi, version 8.0.0.20160204: <a href="http://www.haskell.org/ghc/" rel="noreferrer" target="_blank">http://www.haskell.org/ghc/</a> :? for help<br>
> Loaded GHCi configuration from /home/callen/.ghci<br>
> Prelude> let myList = [1..5 :: Integer]<br>
> Prelude> let myList' = myList ++ undefined<br>
> Prelude> :t myList'<br>
> myList' :: HasCallStack => [Integer]<br>
<br>
If your readers are using :t they must already know about simple types<br>
like Integer, [], and, ->, so the new things are HasCallStack and =>.<br>
This is how I would explain them.<br>
<br>
=> is just like -> except the compiler fills in the argument by<br>
itself.<br>
HasCallStack tells the compiler that the expression needs a call-stack<br>
because it might crash. So HasCallStack => [Integer] is a [Integer]<br>
that<br>
might crash and produce a stack-trace.<br>
<br>
I think the call-stacks are much less scary and confusing than<br>
type-classes in general, which you kind of have to deal with as soon as<br>
you talk about arithmetic.<br>
<br>
Eric<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://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>
</blockquote></div>