Re: Datakind and instance

Georgi Lyubenov <[email protected]>
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <[email protected]>
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.
_______________________________________________
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.