Closed ag-eitilt closed 6 years ago
Hmm, it builds for me on GHC 8.2 with template-haskell 2.12.0.0
: https://travis-ci.org/bennofs/th-lift-instances/jobs/323550862
The hackage matrix builder also succeeds: https://matrix.hackage.haskell.org/package/th-lift-instances#GHC-8.0/th-lift-instances-0.1.4
Might be an issue with installing packages via the Gentoo ebuilds, then. I'll see if I can narrow things down on my end.
On December 31, 2017 6:11:04 AM PST, "Benno Fünfstück" notifications@github.com wrote:
The hackage matrix builder also succeeds: https://matrix.hackage.haskell.org/package/th-lift-instances#GHC-8.0/th-lift-instances-0.1.4
-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/bennofs/th-lift-instances/issues/10#issuecomment-354605851
No, still fails even after installing all the dependencies to the sandbox. You are sure it's actually using template-haskell-2.12.0.0 on your end? I have to add an explicit version restriction to the .cabal to not have it fall back on 2.11.1.0. If that's not it, the only thing I can think of is that I'm still using ghc-8.0.2 as that's the one in the repo, but it seems strange for that to cause an "add (Lift a) to the context of the instance declaration".
@ag-eitilt can you paste the full error that you get?
Paste, no -- I don't have a Javascript-capable browser on that computer (or email client), and don't want to install one just for GitHub. Retype, though, sure:
src/Instances/TH/Lift.hs:137:1: error:
* No instance for (Lift a) arising from a use of 'lift'
Possible fix:
add (Lift a) to the context of the instance declaration
* In the second argument of 'Language.Haskell.TH.Lib.appE', namely
'lift x0_acxN'
In the first argument of 'Language.Haskell.TH.Lib.appE', namely
'Language.Haskell.TH.Lib.appE
(Language.Haskell.TH.Lib.conE
(Language.Haskell.TH.Syntax.Name
(Language.Haskell.TH.Syntax.mkOccName "Node")
(Language.Haskell.TH.Syntax.NameG
Language.Haskell.TH.Syntax.DataName
(Language.Haskell.TH.Syntax.mkPkgName
"containers-0.5.10.2-BsNvjXoQS1iGZ9xbXaQ0Mz")
(Language.Haskell.TH.Syntax.mkModName "Data.Tree"))))
(lift x0_acxN)'
In the expression:
Language.Haskell.TH.Lib.appE
(Language.Haskell.TH.Lib.appE
(Language.Haskell.TH.Lib.conE
(Language.Haskell.TH.Syntax.Name
(Language.Haskell.TH.Syntax.mkOccName "Node")
(Language.Haskell.TH.Syntax.NameG
Language.Haskell.TH.Syntax.DataName
(Language.Haskell.TH.Syntax.mkPkgName
"containers-0.5.10.2-BsNvjXoQS1iGZ9xbXaQ0Mz")
(Language.Haskell.TH.Syntax.mkModName "Data.Tree"))))
(lift x0_acxN))
(lift x1_acxO)
Building with template-haskell ==2.12.0.0
on ghc-8.0.2
is impossible, since https://github.com/haskell/cabal/pull/4185 forbids upgrading it to anything other than the installed version.
That might be the issue, but it's not impossible -- my computer is the proof of that. No, cabal doesn't let me install the new ghc, but it does give me the new TH.
Edit: Ah, that's post-1.24. The change hasn't landed in the Gentoo repo yet.
~ $ ghc --version
The Glorious Glasglow Haskell Compilation System, version 8.0.2
~ $ cabal --version
cabal-install version 1.24.0.2
compiled using version 1.24.2.0 of the Cabal library
~ $ cabal info template-haskell | grep installed
Versions installed: 2.11.1.0
~ $ cd haskell/reflex
~/haskell/reflex $ cabal info template-haskell | grep installed
Versions installed: 2.11.1.0, 2.12.0.0
Ok, using a clean package db I can reproduce this, but I am not sure if there's anything that I can fix here. It may just be that the template-haskell library version needs to match whatever comes with your GHC.
I can understand that, and just so long as it does build correctly with a proper environment, I think it's good enough. Unless you want to replace the single function call with long, twisty code that can at least be annotated. ;)
I dug a little deeper to understand what is happening here and am now certain that GHC does not support using any different version of the TH library than the one that came with it.
The reason that the build fails with template-haskell-2.12
on GHC 8.0.2
is, given data Foo a = Foo a
, reify ''Foo
returns PromotedConsT
for the kind of the type variable a
(whereas StarT
would be correct). That happens because template-haskell-2.12
added a new constructor to the Type
datatype, so at the index where StarT
is in template-haskell-2.11.1.0
is PromotedConsT
in template-haskell-2.12.0.0
.
In fact, it is even possible to make GHC segfault if the version of the template-haskell
lib does not match.
That's really good info, thanks! And thanks for taking the time to work me through this!
In trying to update another package to be compatible with ghc-8.2.1 (which has a dependency on template-haskell-2.12.*), I've found that this fails to build. Specifically, it complains of "No instance for (Lift a)...", and I was able to track it to the line
deriveLift ''Tree.Tree
but then lost the trail -- I'm still relatively new to Haskell, and template Haskell (and especially its errors) remains impenetrable to me.Either the max bound should be reapplied to that depend, or I'd ask someone who is familiar with things to fix it; my attempt utterly failed with a non-exhaustive patten in quickcheck of all places.