summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail/CustomTypeErrors02.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/typecheck/should_fail/CustomTypeErrors02.hs')
-rw-r--r--testsuite/tests/typecheck/should_fail/CustomTypeErrors02.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/CustomTypeErrors02.hs b/testsuite/tests/typecheck/should_fail/CustomTypeErrors02.hs
new file mode 100644
index 0000000000..06eb234071
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/CustomTypeErrors02.hs
@@ -0,0 +1,19 @@
+{-# LANGUAGE DataKinds, UndecidableInstances #-}
+{-# LANGUAGE TypeFamilies, TypeOperators, FlexibleContexts #-}
+module T2 where
+
+import GHC.TypeLits
+
+type family IntRep a where
+ IntRep Int = Integer
+ IntRep Integer = Integer
+ IntRep Bool = Integer
+ IntRep a = TypeError (Text "The type '" :<>: ShowType a :<>:
+ Text "' cannot be represented as an integer.")
+
+convert :: Num (IntRep a) => a -> IntRep a
+convert _ = 5
+
+err = convert id
+
+