[Haskell-cafe] DataKinds + KindSignatures question

Wojtek Narczyński wojtek at power.com.pl
Thu Nov 27 10:04:48 UTC 2014


On 27.11.2014 10:06, Frank Staals wrote:
>
> As Karl explained, type parameters of (->) need to have kind *, whereas
> your argument cmd has kind CmdKind.

Okay, I get it now. I can't have regular functions on types of kind 
other than '*'. I must stop thinking of '*' as some of wildcard.

> A ``workaround'' to this is using
> Proxy (or any other type that has something of kind CmdKind as (phantom)
> type). You can then define something like:
>
> import Data.Proxy
>
> class Serialize (cmd :: CmdKind) where
>      serialize :: Proxy cmd -> ByteString
>
> myByteString = serialize (Proxy :: Proxy GET)
>
> Depending on what you are trying to do that may be applicable.
>
>
Oh, so Proxy can be understood as a type level function from 'CmdKind' 
to '*'?

-- 
Kind regards,
Wojtek Narczynski


More information about the Haskell-Cafe mailing list