summaryrefslogtreecommitdiff
path: root/testsuite/tests/unsatisfiable/T14339_Unsat.hs
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2023-04-29 18:59:10 +0200
committersheaf <sam.derbyshire@gmail.com>2023-04-29 20:23:06 +0200
commit57277662989b97dbf5ddc034d6c41ce39ab674ab (patch)
tree7d9fe1c4cb95a8bcf82490c354b5df0e9ab9037c /testsuite/tests/unsatisfiable/T14339_Unsat.hs
parent4eaf2c2a7682fa9933261f5eb25da9e2333c9608 (diff)
downloadhaskell-57277662989b97dbf5ddc034d6c41ce39ab674ab.tar.gz
Add the Unsatisfiable class
This commit implements GHC proposal #433, adding the Unsatisfiable class to the GHC.TypeError module. This provides an alternative to TypeError for which error reporting is more predictable: we report it when we are reporting unsolved Wanted constraints. Fixes #14983 #16249 #16906 #18310 #20835
Diffstat (limited to 'testsuite/tests/unsatisfiable/T14339_Unsat.hs')
-rw-r--r--testsuite/tests/unsatisfiable/T14339_Unsat.hs25
1 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/tests/unsatisfiable/T14339_Unsat.hs b/testsuite/tests/unsatisfiable/T14339_Unsat.hs
new file mode 100644
index 0000000000..ffa0c141ab
--- /dev/null
+++ b/testsuite/tests/unsatisfiable/T14339_Unsat.hs
@@ -0,0 +1,25 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module T14339_Unsat where
+
+import GHC.TypeError
+
+newtype Foo = Foo Int
+
+class Bar a where
+ bar :: a
+
+instance (Unsatisfiable (Text "Boo")) => Bar Foo where
+ bar = undefined
+
+newtype Baz1 = Baz1 Foo
+
+
+-- should be ok
+deriving instance Unsatisfiable (Text "Shouldn't see this") => Bar Baz1
+
+-- should emit the error "Boo"
+newtype Baz2 = Baz2 Foo
+ deriving Bar