Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For ghc >= 9.4 use a fork of records-sop with relaxed bounds. #339

Merged
merged 2 commits into from May 3, 2023

Conversation

philderbeast
Copy link
Contributor

A follow on from #335 for ghc-9.4.5.

Use a couple of alternate source-repository-package dependencies until records-sop is updated and published to hackage, see kosmikus/records-sop#12.

$ cabal build all --enable-tests --enable-benchmarks
Cloning into '/.../dist-newstyle/src/records-s_-cc0a9700f9cd5a00'...
remote: Enumerating objects: 321, done.
remote: Counting objects: 100% (87/87), done.
remote: Compressing objects: 100% (46/46), done.
remote: Total 321 (delta 31), reused 63 (delta 20), pack-reused 234
Receiving objects: 100% (321/321), 61.90 KiB | 2.38 MiB/s, done.
Resolving deltas: 100% (137/137), done.
HEAD is now at db2d052 Bump stackage resolver to lts-20.18 for ghc-9.2.7.
Resolving dependencies...
Build profile: -w ghc-9.4.5 -O1
In order, the following will be built (use -v for more details):
 - squeal-postgresql-0.9.1.0 (lib) (first run)
 - squeal-postgresql-uuid-ossp-0.1.0.1 (lib) (first run)
 - squeal-postgresql-ltree-0.1.0.1 (lib) (first run)
 - squeal-postgresql-0.9.1.0 (test:spec) (first run)
 - squeal-postgresql-0.9.1.0 (test:properties) (first run)
 - squeal-postgresql-0.9.1.0 (bench:gauge) (first run)
 - squeal-postgresql-0.9.1.0 (exe:example) (first run)
Configuring library for squeal-postgresql-0.9.1.0..
Preprocessing library for squeal-postgresql-0.9.1.0..
Building library for squeal-postgresql-0.9.1.0..
...
[43 of 64] Compiling Squeal.PostgreSQL.Session.Monad

src/Squeal/PostgreSQL/Session/Monad.hs:112:40: warning: [-Wtype-equality-requires-operators]
    The use of ‘~’ without TypeOperators
    will become an error in a future GHC release.
    Suggested fix: Perhaps you intended to use TypeOperators
    |
112 |     :: (MonadTrans t, MonadPQ db m, pq ~ t m)
    |                                        ^

src/Squeal/PostgreSQL/Session/Monad.hs:222:40: warning: [-Wtype-equality-requires-operators]
    The use of ‘~’ without TypeOperators
    will become an error in a future GHC release.
    Suggested fix: Perhaps you intended to use TypeOperators
    |
222 |     :: (MonadTrans t, MonadPQ db m, pq ~ t m)
    | 
 ...
[53 of 64] Compiling Squeal.PostgreSQL.Session

src/Squeal/PostgreSQL/Session/Pool.hs:86:12: warning: [-Wdeprecations]
    In the use of ‘createPool’ (imported from Data.Pool):
    Deprecated: "Use newPool instead"
   |
86 |   liftIO $ createPool (connectdb conninfo) finish stripes idle maxResrc
   |
...

@philderbeast
Copy link
Contributor Author

I've done more testing and found that compilation completes with ghc-9.4.5 and ghc-9.2.7 but with all of the following fails in the same way (and upping -fconstraint-solver-iterations doesn't help):

  • ghc-9.4.4
  • ghc-9.4.3
  • ghc-9.4.2
  • ghc-9.4.1
$ cabal repl squeal-postgresql
Resolving dependencies...
Build profile: -w ghc-9.4.1 -O1
...
src/Squeal/PostgreSQL/Expression/Type.hs:325:19: error:
    • solveWanteds: too many iterations (limit = 4)
        Unsolved: WC {wc_simple =
                        [W] irred_arzs {0}:: sop-core-0.5.0.2:Data.SOP.Constraint.AllF
                                               KnownNat ns0 (CIrredCan(irred))
                        [W] irred_arzy {0}:: sop-core-0.5.0.2:Data.SOP.Constraint.AllF
                                               SOP.Top ns0 (CIrredCan(irred))
                        [W] $dAll_arzz {0}:: SOP.All SOP.Top ns0 (CDictCan(psc))
                        [W] $dAll_arzl {0}:: SOP.All KnownNat ns0 (CDictCan)}
        Simples: {[W] irred_arzs {0}:: sop-core-0.5.0.2:Data.SOP.Constraint.AllF
                                         KnownNat ns0 (CIrredCan(irred)),
                  [W] irred_arzy {0}:: sop-core-0.5.0.2:Data.SOP.Constraint.AllF
                                         SOP.Top ns0 (CIrredCan(irred)),
                  [W] $dAll_arzz {0}:: SOP.All SOP.Top ns0 (CDictCan(psc)),
                  [W] $dAll_arzl {0}:: SOP.All KnownNat ns0 (CDictCan)}
    • In the type signature:
        renderDims :: forall ns. SOP.All KnownNat ns => ByteString
      In an equation for ‘fixarray’:
          fixarray ty
            = UnsafeTypeExpression $ renderSQL ty <> renderDims @dims
            where
                renderDims :: forall ns. SOP.All KnownNat ns => ByteString
                renderDims
                  = ("[" <>) . (<> "]") . intercalate "][" . SOP.hcollapse
                      $ SOP.hcmap
                          (SOP.Proxy @KnownNat) (SOP.K . fromString . show . natVal)
                          (SOP.hpure SOP.Proxy :: SOP.NP SOP.Proxy ns)
    Suggested fix:
      Set limit with -fconstraint-solver-iterations=n; n=0 for no limit
    |
325 |     renderDims :: forall ns. SOP.All KnownNat ns => ByteString
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...

@philderbeast
Copy link
Contributor Author

philderbeast commented Apr 26, 2023

This is "GHC 9.4 regression: solveWanteds: too many iterations" ghc#22516 (discussed on generics-sop#158), fixed in ghc-9.4.5.

Copy link
Contributor

@echatav echatav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@echatav echatav merged commit a0c579b into morphismtech:dev May 3, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants