diff options
Diffstat (limited to 'testsuite/tests/dependent/should_compile/T14749.hs')
-rw-r--r-- | testsuite/tests/dependent/should_compile/T14749.hs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/tests/dependent/should_compile/T14749.hs b/testsuite/tests/dependent/should_compile/T14749.hs new file mode 100644 index 0000000000..c4480fad0f --- /dev/null +++ b/testsuite/tests/dependent/should_compile/T14749.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE GADTs, TypeOperators, DataKinds, TypeFamilies, PolyKinds #-} + +module T14749 where + +import Data.Kind + +data KIND = STAR | KIND :> KIND + +data Ty :: KIND -> Type where + TMaybe :: Ty (STAR :> STAR) + TApp :: Ty (a :> b) -> (Ty a -> Ty b) + +type family IK (k :: KIND) = (res :: Type) where + IK STAR = Type + IK (a:>b) = IK a -> IK b + +type family I (t :: Ty k) = (res :: IK k) where + I TMaybe = Maybe + I (TApp f a) = (I f) (I a) + +data TyRep (k :: KIND) (t :: Ty k) where + TyMaybe :: TyRep (STAR:>STAR) TMaybe + TyApp :: TyRep (a:>b) f -> TyRep a x -> TyRep b (TApp f x) + +zero :: TyRep STAR a -> I a +zero x = case x of + TyApp TyMaybe _ -> Nothing |