hasura / pg-client-hs

A low level Haskell library to connect to postgres
Apache License 2.0
25 stars 15 forks source link

does not build due to `resource-pool` version errors #46

Closed evertedsphere closed 3 years ago

evertedsphere commented 3 years ago

seems like a cabal bug, but for posterity:

on a project depending upon 92975d0f8f933c8d06913dc97af259253bf7fb5f (current master HEAD, as well as the version used by graphql-engine currently), i get errors like

src/Database/PG/Query/Pool.hs:77:23: error:
    Not in scope: ‘RP.getInUseResourceCount’
    Module ‘Data.Pool’ does not export ‘getInUseResourceCount’.
   |
77 | getInUseConnections = RP.getInUseResourceCount . _pool
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^

it seems i have to manually add the source-repository-package block for resource-pool to the cabal.project file, with the exact same contents as the corresponding block in this project's cabal.project file.

jkachmar commented 3 years ago

Not a cabal-install bug, this is just a consequence of the fact that this library isn't generally useful without the specific fork of resource-pool that is used here.


The cabal.project file in this repo only provides dependency overrides for local builds.

When a library or application depends upon pg-client-hs, cabal-install will first try to resolve a compatible version of resource-pool by looking at whatever package set it has available (e.g. Hackage).


In other words, if you were to try to build this project with stack you'd have to add the appropriate resource-pool source to the extra-deps stanza in stack.yaml.

Without this stack would try to look for the version of resource-pool in its package set, which would fail to build with the same error you're seeing here.

evertedsphere commented 3 years ago

ah, yeah, my model of how cabal resolves dependencies seems to have been somewhat nix-like lol