Commit 9e0c1ae5 authored by's avatar
Browse files

Test #6147, which was fixed with the roles commit.

parent 8cc398ff
{-# LANGUAGE GeneralizedNewtypeDeriving, TypeFamilies #-}
module T6147 where
data family T a
data instance T Int = T_Int Int
class C a where
foo :: a -> T a
instance C Int where
foo = T_Int
newtype Foo = Foo Int deriving(C)
Could not coerce from ‛T Int’ to ‛T Foo’
because the first type argument of ‛T’ has role Nominal,
but the arguments ‛Int’ and ‛Foo’ differ
arising from the coercion of the method ‛foo’ from type
‛Int -> T Int’ to type ‛Foo -> T Foo’
Possible fix:
use a standalone 'deriving instance' declaration,
so you can specify the instance context yourself
When deriving the instance for (C Foo)
......@@ -48,3 +48,4 @@ test('T7148', normal, compile_fail, [''])
test('T7148a', normal, compile_fail, [''])
test('T7800', normal, multimod_compile_fail, ['T7800',''])
test('T5498', normal, compile_fail, [''])
test('T6147', normal, compile_fail, [''])
\ No newline at end of file
Supports Markdown
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