[Haskell-cafe] New type of expressions containing (error ...) includes noisy implicit parameter
amindfv at gmail.com
amindfv at gmail.com
Sat Feb 13 18:35:00 UTC 2016
I don't have a copy of GHC 8 atm to test this with: is an expression like this now illegal?
x :: Int
x = undefined
I.e. do you need to write:
x :: HasCallStack => Int
x = undefined
Tom
> El 13 feb 2016, a las 12:37, Oliver Charles <ollie at ocharles.org.uk> escribió:
>
> "What's a call stack?"
>
> (I don't know what Chris' target audience is though)
>
>
>> On Sat, 13 Feb 2016 5:18 pm Eric Seidel <eric at seidel.io> wrote:
>> 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 at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160213/fb0330d4/attachment.html>
More information about the Haskell-Cafe
mailing list