diff options
Diffstat (limited to 'testsuite/tests/indexed-types/should_fail/SimpleFail5b.hs')
-rw-r--r-- | testsuite/tests/indexed-types/should_fail/SimpleFail5b.hs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/testsuite/tests/indexed-types/should_fail/SimpleFail5b.hs b/testsuite/tests/indexed-types/should_fail/SimpleFail5b.hs new file mode 100644 index 0000000000..d05b3bcb36 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/SimpleFail5b.hs @@ -0,0 +1,31 @@ +{-# LANGUAGE TypeFamilies #-} + +module ShouldFail where + +class C3 a where + data S3 a :: * + data S3n a :: * + foo3 :: a -> S3 a + foo3n :: a -> S3n a + bar3 :: S3 a -> a + bar3n :: S3n a -> a + +instance C3 Int where + data S3 Int = D3Int + newtype S3n Int = D3Intn () + foo3 _ = D3Int + foo3n _ = D3Intn () + bar3 D3Int = 1 + bar3n (D3Intn _) = 1 + +instance C3 Char where + data S3 Char = D3Char + foo3 _ = D3Char + bar3 D3Char = 'c' + +bar3' :: S3 Char -> Char +bar3' D3Char = 'a' + +-- must fail: Can't match Int against Char +bar3wrong' D3Int = 1 +bar3wrong' D3Char = 'a' |