diff options
Diffstat (limited to 'testsuite/tests/rep-poly/T20363.hs')
-rw-r--r-- | testsuite/tests/rep-poly/T20363.hs | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/testsuite/tests/rep-poly/T20363.hs b/testsuite/tests/rep-poly/T20363.hs index a28e483ffb..f6ab357972 100644 --- a/testsuite/tests/rep-poly/T20363.hs +++ b/testsuite/tests/rep-poly/T20363.hs @@ -12,37 +12,12 @@ module T20363 where import GHC.Exts -data Nat = Zero | Suc Nat +type NilRep :: RuntimeRep +type family NilRep where + NilRep = TupleRep '[] -type NestedTupleRep :: Nat -> RuntimeRep -> RuntimeRep -type family NestedTupleRep n r where - NestedTupleRep Zero r = TupleRep '[] - NestedTupleRep (Suc n) r = TupleRep '[ r, NestedTupleRep n r ] +type UnitTupleNT :: TYPE NilRep +newtype UnitTupleNT = MkNT (# #) -type NestedTuple - :: forall ( n :: Nat ) - -> forall ( r :: RuntimeRep ) - . forall ( a :: TYPE r ) - -> TYPE ( NestedTupleRep n r ) -type family NestedTuple n a where - NestedTuple Zero @r a = (# #) - NestedTuple (Suc n) @r a = (# a, NestedTuple n @r a #) - -type NestedTupleNT - :: forall ( n :: Nat ) - -> forall ( r :: RuntimeRep ) - . forall ( a :: TYPE r ) - -> TYPE ( NestedTupleRep n r ) -newtype NestedTupleNT n (a :: TYPE r) = MkNT ( NestedTuple n a ) - -test1a :: NestedTuple Zero Addr# -> Int -test1a (# #) = 0 - -test2a :: NestedTuple (Suc Zero) Addr# -> Addr# -test2a (# i, (# #) #) = i - -test1b :: NestedTupleNT Zero Addr# -> Int +test1b :: UnitTupleNT -> Int test1b ( MkNT (# #) ) = 0 - -test2b :: NestedTupleNT (Suc Zero) Addr# -> Addr# -test2b ( MkNT (# i, (# #) #) ) = i |