[Haskell-cafe] DataKinds + KindSignatures question

Wojtek Narczyński wojtek at power.com.pl
Wed Nov 26 21:17:16 UTC 2014


Hello,

The following code:

 > {-# LANGUAGE DataKinds #-}
 > {-# LANGUAGE KindSignatures #-}
 >
 > import Data.ByteString
 >
 > data CmdKind = GET | SET
 >
 > class Serialize (cmd :: CmdKind) where
 >    serialize :: cmd -> ByteString

Results in the following error:

 > wojtek at wojtek-desktop:~/src/he/snip$ ghc dk.hs
 > [1 of 1] Compiling Main             ( dk.hs, dk.o )
 >
 > dk.hs:9:17:
 >     Expected a type, but ‘cmd’ has kind ‘CmdKind’
 >     In the type ‘cmd -> ByteString’
 >     In the class declaration for ‘Serialize’

Is this so by design, or should I write it in a different way, or is it 
just not implemented?

-- 
Kind regards,
Wojtek N.


More information about the Haskell-Cafe mailing list