summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_fail/NoMatchErr.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/indexed-types/should_fail/NoMatchErr.hs')
-rw-r--r--testsuite/tests/indexed-types/should_fail/NoMatchErr.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/indexed-types/should_fail/NoMatchErr.hs b/testsuite/tests/indexed-types/should_fail/NoMatchErr.hs
new file mode 100644
index 0000000000..304e11613e
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_fail/NoMatchErr.hs
@@ -0,0 +1,21 @@
+{-# LANGUAGE NoMonomorphismRestriction #-}
+{-# LANGUAGE TypeFamilies #-}
+
+-- Type error message looks like
+-- TF.hs:12:11:
+-- Couldn't match expected type `Memo d'
+-- against inferred type `Memo d1'
+-- NB: `Memo' is a (non-injective) type function
+--
+-- Note the "NB", which helps point out the problem
+
+module Foo where
+
+class Fun d where
+ type Memo d :: * -> *
+ abst :: (d -> a) -> Memo d a
+ appl :: Memo d a -> (d -> a)
+
+f :: (Fun d) => Memo d a -> Memo d a -- (1)
+f = abst . appl
+