Skip to content
Snippets Groups Projects
Commit 9ed7e8d6 authored by Ryan Scott's avatar Ryan Scott
Browse files

Add regression test for #14246

parent 00f7e285
No related merge requests found
{-# LANGUAGE RankNTypes, GADTs, TypeOperators, PolyKinds, DataKinds, TypeFamilies, AllowAmbiguousTypes, UndecidableInstances, TypeInType #-}
module T14246 where
import Data.Kind -- necessary for *
data Nat = Z | S Nat
data Vect :: Nat -> Type -> Type where
Nil :: Vect Z a
Cons :: a -> Vect n a -> Vect (S n) a
data Label a = Label a
data L
type family KLN (n :: k) :: Nat where
KLN (f :: v -> k) = S (KLN (forall t. f t))
KLN (f :: *) = Z
type family Reveal (n :: k) (l :: Vect (KLN n) L) :: * where
Reveal (f :: v -> k) (Cons (Label (t :: v)) l) = Reveal (f t) l
Reveal (a :: *) Nil = a
T14246.hs:18:5: error:
• Illegal polymorphic type: forall (t :: v). f t
• In the equations for closed type family ‘KLN’
In the type family declaration for ‘KLN’
T14246.hs:22:27: error:
• Expected kind ‘Vect (KLN f) L’,
but ‘Cons (Label (t :: v)) l’ has kind ‘Vect ('S (KLN (f t))) *’
• In the second argument of ‘Reveal’, namely
‘(Cons (Label (t :: v)) l)’
In the type family declaration for ‘Reveal’
T14246.hs:22:67: error:
• Expected kind ‘Vect (KLN (f t)) L’,
but ‘l’ has kind ‘Vect (KLN (f t)) *’
• In the second argument of ‘Reveal’, namely ‘l’
In the type ‘Reveal (f t) l’
In the type family declaration for ‘Reveal’
T14246.hs:23:21: error:
• Expected kind ‘Vect (KLN a) L’, but ‘Nil’ has kind ‘Vect 'Z L’
• In the second argument of ‘Reveal’, namely ‘Nil’
In the type family declaration for ‘Reveal’
......@@ -141,5 +141,6 @@ test('T14033', normal, compile_fail, [''])
test('T14045a', normal, compile_fail, [''])
test('T14175', normal, compile_fail, [''])
test('T14179', normal, compile_fail, [''])
test('T14246', normal, compile_fail, [''])
test('T14369', normal, compile_fail, [''])
test('T15172', normal, compile_fail, [''])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment