[Haskell-cafe] Datakind and instance

PICCA Frederic-Emmanuel frederic-emmanuel.picca at synchrotron-soleil.fr
Thu Jun 13 15:32:54 UTC 2024


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


More information about the Haskell-Cafe mailing list