khibino / haskell-relational-record

This repository includes a joined query generator based on typefull relational algebra, and mapping tools between SQL values list and Haskell record type.
233 stars 36 forks source link

Compile failure with base-4.5 #52

Closed hvr closed 7 years ago

hvr commented 7 years ago

The cabal file states to support base < 5, however at least `base-4.5 does not work:

GHC-7.4/persistable-record-0.5.0.0

Configuring component lib from persistable-record-0.5.0.0...
Preprocessing library persistable-record-0.5.0.0...

src/Database/Record/FromSql.hs:34:8:
    Could not find module `GHC.Generics'
    It is a member of the hidden package `ghc-prim'.
    Perhaps you need to add `ghc-prim' to the build-depends in your .cabal file.
    Use -v to see a list of the files searched for.
khibino commented 7 years ago

The cabal flag ghc74-generic enables ghc-prim-0.2.0.0 which avoids this failure with GHC 7.4.x and base-4.5.

https://travis-ci.org/khibino/haskell-relational-record/jobs/219966118

hvr commented 7 years ago

@khibino Oh, I see... ok, there's still a problem though: the way the .cabal file is written, cabal's solver has no indication that it needs to toggle the flag for GHC 7.4! In fact, future cabal versions may warn about the way that flag was used. In order to do this properly, you'd have to formulate the conditional in such a way, that the flag setting has no degree-of-freedom anymore (i.e. the constraints resulting from each if-branch must be mutually exclusive in some way).

However, in this specific case, there's an easier way to handle this; get rid of the flag and write instead

  if impl(ghc == 7.4.*)
     build-depends: ghc-prim == 0.2.*

I use a variant of this technique in e.g. http://hackage.haskell.org/package/deepseq-1.4.2.0/dependencies

hvr commented 7 years ago

@khibino I went ahead and replaced all flags by the more idiomatic impl()-based pattern, see #53

khibino commented 7 years ago

@hvr If it's alright with you, please tell me your situation using HRR with GHC 7.4.

hvr commented 7 years ago

@khibino well, looking at http://104.239.175.197:8080/package/persistable-record the latest release looks fine

khibino commented 7 years ago

I see. Thanks!