aeson-0.6.1.0 deriveJSON error

ghc doesn't seem to be unifying deriveJSON (String->String) parameter with id :: a -> a. examples/TemplateHaskell.hs:22:14: Couldn't match expected type `Data.Aeson.TH.Options' with actual type `a0 -> a0' In the first argument of `deriveJSON', namely `id' In the expression: deriveJSON id ''Coord ghc --make: /usr/hs/ghc/7.4.1/bin/ghc failure (return code=1) ghc-7.4.1 x86_64 Centos-6 [jim@localhost aeson]$ ghc-pkg list --package-conf=../cabal-dev/packages-7.4.1.conf ../cabal-dev/packages-7.4.1.conf HTTP-4000.2.6 aeson-0.6.1.0 attoparsec-0.10.3.0 attoparsec-conduit-0.5.0.3 base-unicode-symbols-0.2.2.4 blaze-builder-0.3.1.0 blaze-builder-conduit-0.5.0.3 case-insensitive-0.4.0.4 conduit-0.5.6 dlist-0.5 hashable-1.2.0.5 http-types-0.7.3.0.1 lifted-base-0.2.0.2 monad-control-0.3.1.4 nats-0.1 network-2.4.1.0 network-conduit-0.6.2.2 parsec-3.1.3 primitive-0.5.0.1 resourcet-0.4.4 semigroups-0.9 simple-sendfile-0.2.10 transformers-base-0.4.1 unix-compat-0.4.1.0 unordered-containers-0.2.3.0 vault-0.2.0.4 vector-0.10.0.1 void-0.5.11 wai-1.3.0.1 warp-1.3.7.1

On 26 January 2013 14:47,
ghc doesn't seem to be unifying deriveJSON (String->String) parameter with id :: a -> a.
It seems you're using aeson HEAD. Note that the deriveJSON from the released aeson-0.6.1.0 as the type: deriveJSON :: (String -> String) -> Name -> Q [Dec] But in aeson-HEAD it has the following type: deriveJSON :: Options -> Name -> Q [Dec] Cheers, Bas

On 26 January 2013 15:20, Bas van Dijk
But in aeson-HEAD it has the following type:
deriveJSON :: Options -> Name -> Q [Dec]
Note that I'm currently working on extending the encoding Options record: * I added a constructorNameModifier :: String -> String which is applied to constructor names and is handy for lower-casing them for example. * I extended the sumEncoding with a ObjectWithSingleField constructor which causes a constructor to be encoded to an object with a single field named after the constructor (modified by the constructorNameModifier) and the value will be the contents of the constructor. * I'm also modifying the GHC Generics code to take the encoding Options into account. This work is happening in my parameterize-generic-encoding-with-options branch: https://github.com/basvandijk/aeson/commits/parameterize-generic-encoding-wi... Bas

Quoting Bas van Dijk
On 26 January 2013 15:20, Bas van Dijk
wrote: But in aeson-HEAD it has the following type:
deriveJSON :: Options -> Name -> Q [Dec]
Note that I'm currently working on extending the encoding Options record:
* I added a constructorNameModifier :: String -> String which is applied to constructor names and is handy for lower-casing them for example.
* I extended the sumEncoding with a ObjectWithSingleField constructor which causes a constructor to be encoded to an object with a single field named after the constructor (modified by the constructorNameModifier) and the value will be the contents of the constructor.
* I'm also modifying the GHC Generics code to take the encoding Options into account.
This work is happening in my parameterize-generic-encoding-with-options branch:
Both hackage and your branch build TemplateHaskell.hs ok. I'll try and understand what you've done :) Cheers
https://github.com/basvandijk/aeson/commits/parameterize-generic-encoding-wi...
Bas

Quoting Bas van Dijk
On 26 January 2013 14:47,
wrote: ghc doesn't seem to be unifying deriveJSON (String->String) parameter with id :: a -> a.
It seems you're using aeson HEAD. Note that the deriveJSON from the released aeson-0.6.1.0 as the type:
Thanks for the instant help :) Now I know that versions numbers on github don't necessarily get bumped if there's a breaking change. I got confused when I found the hackage documentation was different . Cheers
deriveJSON :: (String -> String) -> Name -> Q [Dec]
But in aeson-HEAD it has the following type:
deriveJSON :: Options -> Name -> Q [Dec]
Cheers,
Bas
participants (2)
-
Bas van Dijk
-
jims@stuttard.org