Skip to content

"Conflicting family instance declaration" error with same type/definition #4705

@parsonsmatt

Description

@parsonsmatt

Please follow the steps below for reporting a bug:

General summary/comments (optional)

Steps to reproduce

$ git clone [email protected]:yesodweb/persistent
$ cd persistent
$ git checkout matt/stack-build-error
$ stack build --test --no-run-tests --fast

Expected

ExitSuccess, or at least an actual error.

Actual

λ ~/Projects/persistent/ matt/stack-build-error stack build --fast --test --no-run-tests
persistent-mongoDB-2.8.0: unregistering (local file changes: test/MongoInit.hs)
persistent-test-2.0.2.0: unregistering (missing dependencies: persistent-mongoDB)
persistent-2.9.2: Test running disabled by --no-run-tests flag.
persistent-mongoDB-2.8.0: configure
persistent-redis-2.5.2.2: Test running disabled by --no-run-tests flag.
persistent-sqlite-2.9.2: Test running disabled by --no-run-tests flag.
persistent-template-2.6.0: Test running disabled by --no-run-tests flag.
persistent-mongoDB-2.8.0: build
persistent-mongoDB-2.8.0: copy/register
persistent-test-2.0.2.0: configure (lib + exe)
persistent-test-2.0.2.0: build (lib + exe)
persistent-test-2.0.2.0: copy/register
persistent-mongoDB-2.8.0: configure (test)
persistent-mongoDB-2.8.0: build (test)
persistent-qq-2.9.1: configure (test)
persistent-qq-2.9.1: build (test)
persistent-qq-2.9.1: Test running disabled by --no-run-tests flag.
Log files have been written to: /home/matt/Projects/persistent/.stack-work/logs/
Progress 9/10

--  While building package persistent-mongoDB-2.8.0 using:
      /home/matt/.stack/setup-exe-cache/x86_64-linux/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.4 --
builddir=.stack-work/dist/x86_64-linux/Cabal-2.4.0.1 build test:test --ghc-options " -ddump-hi
-ddump-to-file -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/matt/Projects/persistent/.stack-work/logs/persistent-mongo
DB-2.8.0.log

    Configuring persistent-mongoDB-2.8.0...
    Preprocessing library for persistent-mongoDB-2.8.0..
    Building library for persistent-mongoDB-2.8.0..
    [1 of 1] Compiling Database.Persist.MongoDB ( Database/Persist/MongoDB.hs, .stack-work/dist
/x86_64-linux/Cabal-2.4.0.1/build/Database/Persist/MongoDB.o )
    Preprocessing test suite 'test' for persistent-mongoDB-2.8.0..
    Building test suite 'test' for persistent-mongoDB-2.8.0..
    [1 of 4] Compiling MongoInit        ( test/MongoInit.hs, .stack-work/dist/x86_64-linux/Caba
l-2.4.0.1/build/test/test-tmp/MongoInit.o )

    /home/matt/Projects/persistent/persistent-mongoDB/test/MongoInit.hs:1:1: error:
        Conflicting family instance declarations:
          BackendKey MongoDB.MongoContext
            -- Defined in ‘Database.Persist.MongoDB’
          BackendKey MongoDB.MongoContext
            -- Defined in ‘persistent-mongoDB-2.8.0:Database.Persist.MongoDB’
      |
    1 | {-# LANGUAGE ScopedTypeVariables #-}
      | ^

    /home/matt/Projects/persistent/persistent-mongoDB/test/MongoInit.hs:1:1: error:
        Conflicting family instance declarations:
          BackendSpecificFilter
            MongoDB.MongoContext record = Database.Persist.MongoDB.MongoFilter
                                            record
            -- Defined in ‘Database.Persist.MongoDB’
          BackendSpecificFilter
            MongoDB.MongoContext
            record = persistent-mongoDB-2.8.0:Database.Persist.MongoDB.MongoFilter
                       record
            -- Defined in ‘persistent-mongoDB-2.8.0:Database.Persist.MongoDB’
      |
    1 | {-# LANGUAGE ScopedTypeVariables #-}
      | ^

    /home/matt/Projects/persistent/persistent-mongoDB/test/MongoInit.hs:1:1: error:
        Conflicting family instance declarations:
          BackendSpecificUpdate
            MongoDB.MongoContext record = Database.Persist.MongoDB.MongoUpdate
                                            record
            -- Defined in ‘Database.Persist.MongoDB’
          BackendSpecificUpdate
            MongoDB.MongoContext
            record = persistent-mongoDB-2.8.0:Database.Persist.MongoDB.MongoUpdate
                       record
            -- Defined in ‘persistent-mongoDB-2.8.0:Database.Persist.MongoDB’
      |
    1 | {-# LANGUAGE ScopedTypeVariables #-}
      | ^

The location it gives are for the exact same place. It would appear that the test-suite is somehow gaining privileged access to the Database.Persist.MongoDB module. Removing the dependency in the cabal file does not fix the problem - instead, we get an error where the module is not available to import.

Gist with the command run with --verbose

Stack version

λ ~/Projects/persistent/ stack --version
Version 1.9.3, Git revision 40cf7b37526b86d1676da82167ea8758a854953b (6211 commits) x86_64 hpa
ck-0.31.1

Method of installation

  • Fresh upgrade via stack upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions