Fix error-message suppress on given equalities
[ghc.git] / testsuite / tests / typecheck / should_fail / T13446.hs
1 {-# LANGUAGE ConstraintKinds #-}
2 {-# LANGUAGE DataKinds #-}
3 {-# LANGUAGE FlexibleContexts #-}
4 {-# LANGUAGE FlexibleInstances #-}
5 {-# LANGUAGE MultiParamTypeClasses #-}
6 {-# LANGUAGE GADTs #-}
7 {-# LANGUAGE RankNTypes #-}
8 {-# LANGUAGE TypeFamilies #-}
9 {-# LANGUAGE TypeOperators #-}
10 {- # OPTIONS_GHC -fno-defer-type-errors #-}
11 module T13446 where
12
13 import Data.Coerce (Coercible)
14 import GHC.Exts (Constraint)
15 import GHC.TypeLits (Symbol)
16
17 data Dict :: Constraint -> * where
18 Dict :: a => Dict a
19
20 infixr 9 :-
21 newtype a :- b = Sub (a => Dict b)
22 instance a => Show (a :- b) where
23 showsPrec d (Sub Dict) = showParen (d > 10) $ showString "Sub Dict"
24
25 class Lifting p f where
26 lifting :: p a :- p (f a)
27
28 data Blah a = Blah
29
30 newtype J (a :: JType) = J (Blah (J a))
31 newtype JComparable a = JComparable (J (T (JTy a)))
32
33 instance Lifting JReference JComparable where
34 lifting = Sub 'a'
35
36 class (Coercible a (J (JTy a))) => JReference a where
37 type JTy a :: JType
38
39 type T a
40 = 'Generic ('Iface "java.lang.Comparable") '[a]
41 data JType = Class Symbol
42 | Generic JType [JType]
43 | Iface Symbol
44 type JObject = J (Class "java.lang.Object")
45 instance JReference JObject where
46 type JTy JObject = 'Class "java.lang.Object"