
27 Nov
2014
27 Nov
'14
5:04 a.m.
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