ndmitchell / record-dot-preprocessor

A preprocessor for a Haskell record syntax using dot
Other
129 stars 19 forks source link

Producing incorrect HasField in presence of KindSignature #28

Closed mageshb closed 4 years ago

mageshb commented 4 years ago

Problem happens with Preprocessor. Following works fine,

data User f = User
 { name :: String }

Following fail (ignores the type parameter with KindSignature),

data UserF (f :: Type -> Type) = UserF
 { name :: String } 

Error

[1 of 1] Compiling MyLib            ( src/MyLib.hs, interpreted )

src/MyLib.hs:201:29: error:
    • Expecting one more argument to ‘UserF’
      Expected a type, but ‘UserF’ has kind ‘(* -> *) -> *’
    • In the second argument of ‘Z.HasField’, namely ‘(UserF)’
      In the instance declaration for
        ‘Z.HasField "name" (UserF) (String)’
Failed, no modules loaded.

src/MyLib.hs:201:29: error:
    • Expecting one more argument to ‘UserF’
      Expected a type, but ‘UserF’ has kind ‘(* -> *) -> *’
    • In the second argument of ‘Z.HasField’, namely ‘(UserF)’
      In the instance declaration for
        ‘Z.HasField "name" (UserF) (String)’
ndmitchell commented 4 years ago

Thanks for the report. I've pushed a new version which has a fix and a test for kind signatures. Can you try master and see if that fixes it for you? If it does, or if you are unable to try from master, I'll make a release.

mageshb commented 4 years ago

The new version works. Thank you for the quick fix.

ndmitchell commented 4 years ago

Thanks for the test. I released 0.2.5 including the fix.