Expected a type

Wojtek Narczyński wojtek at power.com.pl
Mon Feb 8 19:36:07 UTC 2016


Dear Devs,

I've tried to ask this in the ($) thread, but it was totally offtopic 
there and I was ignored just as I deserved :-)

Consider the following example.

wojtek at Desktop2016:~/src/he$ cat kinds.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}

data K = A | B

f :: (A :: K) -> (B :: K)
f _ = undefined

wojtek at Desktop2016:~/src/he$ /opt/ghc/head/bin/ghc kinds.hs
[1 of 1] Compiling Main             ( kinds.hs, kinds.o )

kinds.hs:6:6: error:
     • Expected a type, but ‘'A’ has kind ‘K’
     • In the type signature:
         f :: (A :: K) -> (B :: K)

kinds.hs:6:18: error:
     • Expected a type, but ‘'B’ has kind ‘K’
     • In the type signature:
         f :: (A :: K) -> (B :: K)

As Roman kindly (!) explained to me some time ago, GHC really means 
"Expected a type of kind '*' (or '#')..."

Now that GHC is apparently undergoing a major overhaul of its internals, 
would it be possible to allow types of various kinds in functions? Would 
it make sense? May I file a ticket?

-- 
Kind regards,
Wojtek Narczynski


More information about the ghc-devs mailing list