diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2012-10-05 16:33:07 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2012-10-05 16:33:07 +0100 |
commit | e70e497d2e35c85a028f15438da6682214243c22 (patch) | |
tree | 86d603f54f1ab9bbed83b63f97b39068db0a8720 /testsuite | |
parent | 7fdd69fc5ab5161487adbc6286811f1dbc96e34b (diff) | |
download | haskell-e70e497d2e35c85a028f15438da6682214243c22.tar.gz |
Test Trac #7293
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/gadt/T7293.hs | 24 | ||||
-rw-r--r-- | testsuite/tests/gadt/T7293.stderr | 1 | ||||
-rw-r--r-- | testsuite/tests/gadt/all.T | 1 |
3 files changed, 26 insertions, 0 deletions
diff --git a/testsuite/tests/gadt/T7293.hs b/testsuite/tests/gadt/T7293.hs new file mode 100644 index 0000000000..26d9188f81 --- /dev/null +++ b/testsuite/tests/gadt/T7293.hs @@ -0,0 +1,24 @@ +{-# LANGUAGE GADTs, DataKinds, KindSignatures, TypeFamilies, + TypeOperators, RankNTypes #-} + +module T7294 where + +data Nat = Zero | Succ Nat + +data Vec :: * -> Nat -> * where + Nil :: Vec a Zero + Cons :: a -> Vec a n -> Vec a (Succ n) + +type family (m :: Nat) :< (n :: Nat) :: Bool +type instance m :< Zero = False +type instance Zero :< Succ n = True +type instance Succ n :< Succ m = n :< m + +data SNat :: Nat -> * where + SZero :: SNat Zero + SSucc :: forall (n :: Nat). SNat n -> SNat (Succ n) + +nth :: ((k :< n) ~ True) => Vec a n -> SNat k -> a +nth (Cons x _) SZero = x +nth (Cons _ xs) (SSucc k) = nth xs k +nth Nil _ = undefined diff --git a/testsuite/tests/gadt/T7293.stderr b/testsuite/tests/gadt/T7293.stderr new file mode 100644 index 0000000000..0519ecba6e --- /dev/null +++ b/testsuite/tests/gadt/T7293.stderr @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/testsuite/tests/gadt/all.T b/testsuite/tests/gadt/all.T index ac560219a5..566afcbf5e 100644 --- a/testsuite/tests/gadt/all.T +++ b/testsuite/tests/gadt/all.T @@ -114,3 +114,4 @@ test('T5424', test('FloatEq', normal, compile, ['']) test('T7205', normal, compile, ['']) +test('T7293', normal, compile_fail, ['']) |