summaryrefslogtreecommitdiff
path: root/testsuite/tests/deriving/should_compile/T14883.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/deriving/should_compile/T14883.hs')
-rw-r--r--testsuite/tests/deriving/should_compile/T14883.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/tests/deriving/should_compile/T14883.hs b/testsuite/tests/deriving/should_compile/T14883.hs
new file mode 100644
index 0000000000..0ec4b5f786
--- /dev/null
+++ b/testsuite/tests/deriving/should_compile/T14883.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE ConstraintKinds #-}
+{-# LANGUAGE ImpredicativeTypes #-}
+{-# LANGUAGE InstanceSigs #-}
+{-# LANGUAGE KindSignatures #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE QuantifiedConstraints #-}
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE TypeApplications #-}
+module T14883 where
+
+import Data.Coerce
+import Data.Kind
+
+type Representational1 m = (forall a b. Coercible a b => Coercible (m a) (m b) :: Constraint)
+
+class Representational1 f => Functor' f where
+ fmap' :: (a -> b) -> f a -> f b
+
+class Functor' f => Applicative' f where
+ pure' :: a -> f a
+ (<*>@) :: f (a -> b) -> f a -> f b
+
+class Functor' t => Traversable' t where
+ traverse' :: Applicative' f => (a -> f b) -> t a -> f (t b)
+
+-- Typechecks
+newtype T1 m a = MkT1 (m a) deriving Functor'
+deriving instance Traversable' m => Traversable' (T1 m)