"What's a call stack?"
(I don't know what Chris' target audience is though)
Here's what the GHCi session should look like.
> $ ghci
> GHCi, version 8.0.0.20160204: http://www.haskell.org/ghc/ :? for help
> Loaded GHCi configuration from /home/callen/.ghci
> Prelude> let myList = [1..5 :: Integer]
> Prelude> let myList' = myList ++ undefined
> Prelude> :t myList'
> myList' :: HasCallStack => [Integer]
If your readers are using :t they must already know about simple types
like Integer, [], and, ->, so the new things are HasCallStack and =>.
This is how I would explain them.
=> is just like -> except the compiler fills in the argument by
itself.
HasCallStack tells the compiler that the expression needs a call-stack
because it might crash. So HasCallStack => [Integer] is a [Integer]
that
might crash and produce a stack-trace.
I think the call-stacks are much less scary and confusing than
type-classes in general, which you kind of have to deal with as soon as
you talk about arithmetic.
Eric
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe