Instantiate GND bindings with an explicit type signature
[ghc.git] / testsuite / tests / deriving / should_compile / T14883.hs
1 {-# LANGUAGE ConstraintKinds #-}
2 {-# LANGUAGE ImpredicativeTypes #-}
3 {-# LANGUAGE InstanceSigs #-}
4 {-# LANGUAGE KindSignatures #-}
5 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
6 {-# LANGUAGE QuantifiedConstraints #-}
7 {-# LANGUAGE RankNTypes #-}
8 {-# LANGUAGE ScopedTypeVariables #-}
9 {-# LANGUAGE StandaloneDeriving #-}
10 {-# LANGUAGE TypeApplications #-}
11 module T14883 where
12
13 import Data.Coerce
14 import Data.Kind
15
16 type Representational1 m = (forall a b. Coercible a b => Coercible (m a) (m b) :: Constraint)
17
18 class Representational1 f => Functor' f where
19 fmap' :: (a -> b) -> f a -> f b
20
21 class Functor' f => Applicative' f where
22 pure' :: a -> f a
23 (<*>@) :: f (a -> b) -> f a -> f b
24
25 class Functor' t => Traversable' t where
26 traverse' :: Applicative' f => (a -> f b) -> t a -> f (t b)
27
28 -- Typechecks
29 newtype T1 m a = MkT1 (m a) deriving Functor'
30 deriving instance Traversable' m => Traversable' (T1 m)