shithub: MicroHs

ref: bdd38072a2fa4108fff41da806309074e79ce6de
dir: /tests/HigherKind.hs/

View raw version
module HigherKind(main) where
import Prelude

data T f = C (f Int)

showT :: forall f . (f Int -> String) -> T f -> String
showT f (C x) = "(C " ++ f x ++ ")"

data TT f a = CC (f a)

showTT :: forall f a . (f a -> String) -> TT f a -> String
showTT f (CC x) = "(CC " ++ f x ++ ")"

type H :: (Type -> Type) -> Type
data H a = H

type HH :: forall (k::Kind) . k -> Type
data HH a = HH

hh1 :: HH Int
hh1 = HH
hh2 :: HH []
hh2 = HH

type List = []

tt :: TT List Int
tt = CC [1]

x :: Int
x =
  let h :: H []
      h = H
  in  1

showLI :: [Int] -> String
showLI = show

main :: IO ()
main = do
  let t = C [1]
  putStrLn $ showT  showLI t
  putStrLn $ showTT showLI tt