Commit a96c4e7c authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Add comments to TcCoercibleFail

Flag up the problem highlighted in Trac #11518 comment:15
parent 6036cb6f
......@@ -20,9 +20,16 @@ foo4 = coerce $ one :: Down Int
newtype Void = Void Void
foo5 = coerce :: Void -> ()
------------------------------------
-- This next one generates an exponentally big type as it
-- tries to unwrap. See comment:15 in Trac #11518
-- Adding asserions that force the types can make us
-- run out of space.
newtype VoidBad a = VoidBad (VoidBad (a,a))
foo5' = coerce :: (VoidBad ()) -> ()
------------------------------------
-- This shoul fail with a context stack overflow
newtype Fix f = Fix (f (Fix f))
foo6 = coerce :: Fix (Either Int) -> Fix (Either Age)
......
......@@ -37,14 +37,14 @@ TcCoercibleFail.hs:21:8: error:
• In the expression: coerce :: Void -> ()
In an equation for ‘foo5’: foo5 = coerce :: Void -> ()
TcCoercibleFail.hs:24:9: error:
TcCoercibleFail.hs:30:9: error:
• Couldn't match representation of type ‘VoidBad ()’
with that of ‘()’
arising from a use of ‘coerce’
• In the expression: coerce :: (VoidBad ()) -> ()
In an equation for ‘foo5'’: foo5' = coerce :: (VoidBad ()) -> ()
TcCoercibleFail.hs:28:8: error:
TcCoercibleFail.hs:35:8: error:
• Reduction stack overflow; size = 201
When simplifying the following type:
Coercible (Fix (Either Int)) (Fix (Either Age))
......@@ -56,7 +56,7 @@ TcCoercibleFail.hs:28:8: error:
In an equation for ‘foo6’:
foo6 = coerce :: Fix (Either Int) -> Fix (Either Age)
TcCoercibleFail.hs:29:8: error:
TcCoercibleFail.hs:36:8: error:
• Couldn't match representation of type ‘Either
Int (Fix (Either Int))’
with that of ‘()’
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment