[Haskell-cafe] Datakind and instance
Georgi Lyubenov
godzbanebane at gmail.com
Thu Jun 13 20:06:04 UTC 2024
You can make it polykinded:
{-# LANGAUGE PolyKinds #-}
class HasIniConfig (a :: k) where
getConfig ...
And then you can use both types of kind ProjectionType, and also
"regular types" of kind Type.
On 6/13/24 18:32, PICCA Frederic-Emmanuel wrote:
> Hello,
>
> I have a class
>
> class HasIniConfig where
> getConfig ...
>
> a kind using DataKind
>
> data ProjectionType = TypeA
> | TypeB
> ...
>
> I would like to create instance for each 'TypeX
>
> But when I try to write an instance
>
> I get this error
>
> src/Hkl/Binoculars/Projections/QCustom.hs:195:23: error:
> • Expected a type, but
> ‘'QCustomProjection’ has kind
> ‘ProjectionType’
> • In the first argument of ‘HasIniConfig’, namely
> ‘'QCustomProjection’
> In the instance declaration for ‘HasIniConfig 'QCustomProjection’
> |
> 195 | instance HasIniConfig 'QCustomProjection where
> | ^^^^^^^^^^^^^^^^^^
>
>
> I should add class HasIniConfig (a :: ProjectionType) where
>
> But in that cas I can not create instance for other type, and I need to :)
>
> I would be glade if someone could explain how to all this.
>
> Thanks
>
> Frederic
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
More information about the Haskell-Cafe
mailing list