<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>I don't have a copy of GHC 8 atm to test this with: is an expression like this now illegal?</div><div><br></div><div>x :: Int</div><div>x = undefined</div><div><br></div><div>I.e. do you need to write:</div><div><br></div><div>x :: HasCallStack => Int</div><div>x = undefined</div><div><br></div><div>Tom</div><div><br></div><div><br>El 13 feb 2016, a las 12:37, Oliver Charles <<a href="mailto:ollie@ocharles.org.uk">ollie@ocharles.org.uk</a>> escribió:<br><br></div><blockquote type="cite"><div><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>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Haskell-Cafe mailing list</span><br><span><a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a></span><br><span><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a></span><br></div></blockquote></body></html>