summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testsuite/tests/indexed-types/should_fail/T8155.hs30
-rw-r--r--testsuite/tests/indexed-types/should_fail/T8155.stderr9
-rw-r--r--testsuite/tests/indexed-types/should_fail/all.T3
3 files changed, 41 insertions, 1 deletions
diff --git a/testsuite/tests/indexed-types/should_fail/T8155.hs b/testsuite/tests/indexed-types/should_fail/T8155.hs
new file mode 100644
index 0000000000..97f8961327
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_fail/T8155.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE FlexibleInstances #-}
+
+module Test where
+
+
+data Vector a = Vector a
+data Matrix a = Matrix a
+
+class Build f where
+ build' :: BoundsOf f -> f -> ContainerOf f
+
+
+
+type family BoundsOf x where
+ BoundsOf (a->a->a) = (Int,Int)
+ BoundsOf (a->a) = Int
+
+type family ContainerOf x where
+ ContainerOf (a->a) = Vector a
+ ContainerOf (a->a->a) = Matrix a
+
+
+
+instance (Num a) => Build (a->a) where
+ build' = buildV
+
+
+buildV :: (Integral a, Num b) => a -> (b -> c) -> Vector c
+buildV _ _ = undefined
diff --git a/testsuite/tests/indexed-types/should_fail/T8155.stderr b/testsuite/tests/indexed-types/should_fail/T8155.stderr
new file mode 100644
index 0000000000..c85b84b4c8
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_fail/T8155.stderr
@@ -0,0 +1,9 @@
+
+T8155.hs:26:14:
+ Could not deduce (Integral (BoundsOf (a -> a)))
+ arising from a use of ‛buildV’
+ from the context (Num a)
+ bound by the instance declaration at T8155.hs:25:10-32
+ In the expression: buildV
+ In an equation for ‛build'’: build' = buildV
+ In the instance declaration for ‛Build (a -> a)’
diff --git a/testsuite/tests/indexed-types/should_fail/all.T b/testsuite/tests/indexed-types/should_fail/all.T
index 14344da0bd..68fb9eadbd 100644
--- a/testsuite/tests/indexed-types/should_fail/all.T
+++ b/testsuite/tests/indexed-types/should_fail/all.T
@@ -105,4 +105,5 @@ test('T7938', normal, compile_fail, [''])
test('ClosedFam3', extra_clean(['ClosedFam3.o-boot', 'ClosedFam3.hi-boot']),
multimod_compile_fail, ['ClosedFam3', '-v0'])
-test('ClosedFam4', normal, compile_fail, ['']) \ No newline at end of file
+test('ClosedFam4', normal, compile_fail, [''])
+test('T8155', normal, compile_fail, [''])