diff options
Diffstat (limited to 'testsuite/tests/patsyn/should_fail/T14498.hs')
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T14498.hs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/testsuite/tests/patsyn/should_fail/T14498.hs b/testsuite/tests/patsyn/should_fail/T14498.hs new file mode 100644 index 0000000000..0744310aee --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T14498.hs @@ -0,0 +1,32 @@ +{-# Language PatternSynonyms, ViewPatterns, GADTs, ConstraintKinds, RankNTypes, KindSignatures, PolyKinds, ScopedTypeVariables, DataKinds #-} + +module T14498 where + +import Type.Reflection +import Data.Kind + +data Dict c where Dict :: c => Dict c + +asTypeable :: TypeRep a -> Dict (Typeable a) +asTypeable rep = + withTypeable rep + Dict + +pattern Typeable :: () => Typeable a => TypeRep a +pattern Typeable <- (asTypeable -> Dict) + where Typeable = typeRep + +data N = O | S N + +type SN = (TypeRep :: N -> Type) + +pattern SO = (Typeable :: TypeRep (O::N)) + +pattern SS :: + forall (t :: k'). + () + => forall (a :: kk -> k') (n :: kk). + (t ~ a n) + => + TypeRep n -> TypeRep t +pattern SS n <- (App (Typeable :: TypeRep (a ::kk -> k')) n) |