Implement QuantifiedConstraints
[ghc.git] / testsuite / tests / quantified-constraints / T9123.hs
1 {-# LANGUAGE RankNTypes #-}
2 {-# LANGUAGE ScopedTypeVariables #-}
3 {-# LANGUAGE TypeApplications #-}
4 {-# LANGUAGE TypeFamilies #-}
5 {-# LANGUAGE QuantifiedConstraints #-}
6 {-# LANGUAGE UndecidableInstances #-}
7 {-# LANGUAGE InstanceSigs, RoleAnnotations #-}
8
9 module T9123 where
10
11 import Data.Coerce
12
13 type role Wrap representational nominal
14 newtype Wrap m a = Wrap (m a)
15
16 class Monad' m where
17 join' :: forall a. m (m a) -> m a
18
19 -- Tests the superclass stuff
20 instance (forall p q. Coercible p q => Coercible (m p) (m q), Monad' m) => Monad' (Wrap m) where
21 join' :: forall a. Wrap m (Wrap m a) -> Wrap m a
22 join' = coerce @(m (m a) -> m a)
23 @(Wrap m (Wrap m a) -> Wrap m a)
24 join'
25