Haskell-OpenAPI-Code-Generator / Haskell-OpenAPI-Client-Code-Generator

Generate Haskell client code from an OpenAPI 3 specification
47 stars 19 forks source link

Installation failure - Duplicate instance declarations #60

Closed freizl closed 3 years ago

freizl commented 3 years ago

Any hints on how to resolve this? Thank you!

➜  okta-oas3 git:(master) cabal --version
cabal-install version 3.2.0.0
compiled using version 3.2.0.0 of the Cabal library
➜  okta-oas3 git:(master) ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.10.4
➜  okta-oas3 git:(master) cabal install openapi3-code-generator
Resolving dependencies...
Build profile: -w ghc-8.10.4 -O1
In order, the following will be built (use -v for more details):
 - openapi3-code-generator-0.1.0.6 (lib) (requires build)
 - openapi3-code-generator-0.1.0.6 (exe:openapi3-code-generator-exe) (requires build)
Starting     openapi3-code-generator-0.1.0.6 (lib)
Building     openapi3-code-generator-0.1.0.6 (lib)

Failed to build openapi3-code-generator-0.1.0.6.
Build log (
/Users/haisheng/.cabal/logs/ghc-8.10.4/pnp3-cd-gnrtr-0.1.0.6-9018910b.log
):
Configuring library for openapi3-code-generator-0.1.0.6..
Preprocessing library for openapi3-code-generator-0.1.0.6..
Building library for openapi3-code-generator-0.1.0.6..
[ 1 of 18] Compiling OpenAPI.Common   ( src/OpenAPI/Common.hs, dist/build/OpenAPI/Common.o, dist/build/OpenAPI/Common.dyn_o )
[ 2 of 18] Compiling OpenAPI.Generate.Flags ( src/OpenAPI/Generate/Flags.hs, dist/build/OpenAPI/Generate/Flags.o, dist/build/OpenAPI/Generate/Flags.dyn_o )
[ 3 of 18] Compiling OpenAPI.Generate.Types.ExternalDocumentation ( src/OpenAPI/Generate/Types/ExternalDocumentation.hs, dist/build/OpenAPI/Generate/Types/ExternalDocumentation.o, dist/build/OpenAPI/Generate/Types/ExternalDocumentation.dyn_o )
[ 4 of 18] Compiling OpenAPI.Generate.Types.Referencable ( src/OpenAPI/Generate/Types/Referencable.hs, dist/build/OpenAPI/Generate/Types/Referencable.o, dist/build/OpenAPI/Generate/Types/Referencable.dyn_o )
[ 5 of 18] Compiling OpenAPI.Generate.Types.Schema ( src/OpenAPI/Generate/Types/Schema.hs, dist/build/OpenAPI/Generate/Types/Schema.o, dist/build/OpenAPI/Generate/Types/Schema.dyn_o )

src/OpenAPI/Generate/Types/Schema.hs:140:10: error:
    Duplicate instance declarations:
      instance Ord Value
        -- Defined at src/OpenAPI/Generate/Types/Schema.hs:140:10
      instance Ord Value
        -- Defined in ‘aeson-1.5.6.0:Data.Aeson.Types.Internal’
    |
140 | instance Ord Value where
    |          ^^^^^^^^^
cabal: Failed to build openapi3-code-generator-0.1.0.6 (which is required by
exe:openapi3-code-generator-exe from openapi3-code-generator-0.1.0.6). See the
build log above for details.
joel-bach commented 3 years ago

Hi @freizl We use stack for the dependency management to get compatible package versions. Currently, lts-16.12 is used as the resolver and this means aeson-1.4.7.1 is used. I guess because you directly use cabal, it takes the newest version (aeson-1.5.6.0) which is not compatible with the current implementation. I would either use stack to resolve it or adjust the cabal file locally to pin the version aeson-1.4.7.1. Does this help?

freizl commented 3 years ago

Hi @joelfisch, yeah, stack works perfectly (I was able to build from source code as well) !

I'm curious what would be resolution in order to be compatible with aeson-1.5.6?

Thanks!

joel-bach commented 3 years ago

Hi @freizl , I guess you can just remove the Ord instance of Value in src/OpenAPI/Generate/Types/Schema.hs:140 entirely. Can I close this issue?