dreixel / generic-deriving

BSD 3-Clause "New" or "Revised" License
44 stars 32 forks source link

Failure with GHC 8.8 / template-haskell 2.15.0 #60

Closed deepfire closed 5 years ago

deepfire commented 5 years ago
[13 of 20] Compiling Generics.Deriving.TH.Internal ( src/Generics/Deriving/TH/Internal.hs, dist/build/Generics/Deriving/TH/Internal.o )

src/Generics/Deriving/TH/Internal.hs:459:22: error:
    • Couldn't match type ‘TyVarBndr’ with ‘Type’
      Expected type: Q (Either
                          String (Name, [Type], [ConstructorInfo], DatatypeVariant_))
        Actual type: Q (Either
                          [Char] (Name, [TyVarBndr], [ConstructorInfo], DatatypeVariant_))
    • In the expression:
        do return $ Left $ ns ++ " Could not reify " ++ nameBase name
          `recover`
            do DatatypeInfo {datatypeContext = ctxt, datatypeName = parentName,
                             datatypeVars = tys, datatypeVariant = variant,
                             datatypeCons = cons} <- reifyDatatype name
               let variant_ = ...
               checkDataContext parentName ctxt
                 $ Right (parentName, tys, cons, variant_)
      In an equation for ‘reifyDataInfo’:
          reifyDataInfo name
            = do return $ Left $ ns ++ " Could not reify " ++ nameBase name
                `recover`
                  do DatatypeInfo {datatypeContext = ctxt, datatypeName = parentName,
                                   datatypeVars = tys, datatypeVariant = variant,
                                   datatypeCons = cons} <- reifyDatatype name
                     let variant_ = ...
                     checkDataContext parentName ctxt
                       $ Right (parentName, tys, cons, variant_)
            where
                ns :: String
                ns = "Generics.Deriving.TH.reifyDataInfo: "
    |
459 | reifyDataInfo name = do
    |                      ^^...
RyanGlScott commented 5 years ago

How are you building this? generic-deriving-1.12.2 should build fine using the latest head.hackage commit.

RyanGlScott commented 5 years ago

I'm especially confused here since the error message mentions TyVarBndr, which shouldn't happen. You aren't using a pre-release version of th-abstraction-0.3.0.0, are you?

deepfire commented 5 years ago

@RyanGlScott, oh, I am, indeed, using heavy overrides from git masters all over the place.

I guess I need to figure out versions better. Thing is, the strategy of chasing latest master often works rather well, because people often have latest fixes unreleased -- but sometimes, like here, it bites.

Thank you, and sorry for the confusion!

RyanGlScott commented 5 years ago

Generally speaking, you shouldn't need any local overrides if you're using head.hackage + --allow-newer=template-haskell. (For instance, there's a head.hackage patch for th-abstraction-0.2.10.0 that works with template-haskell-2.15.) If you do find yourself patching something locally, consider submitting that patch to head.hackage—you'll save work for yourself (and everyone else) in the long run, especially since there will inevitably be changes that have yet to land in GHC 8.8 before its final release.

th-abstraction-0.3.0.0 will feature at least one major breaking change, and upstream libraries (such as this one) haven't yet had time to update accordingly. For the sake of your long-term sanity, I'd recommend not trying to use it :)

deepfire commented 5 years ago

Speaking of pointless projects: https://github.com/deepfire/nix-head

The idea is to take head.hackage and build on top of it a low-friction Nix-based workbench for overrides -- with the notion that overrides subsume patching (by allowing more flexibility).

This can be used as staging ground for patch development.

RyanGlScott commented 5 years ago

Cool! If I ever force myself to learn Nix, nix-head would be a valuable resource.

Assuming that that works for you, is there actually a problem to be addressed here? Or can I close this issue?

deepfire commented 5 years ago

Let's close it for now, and in case something goes wrong, we can always reopen : -)

Fuuzetsu commented 5 years ago

I also hit this, I'm trying to build something with GHC HEAD and this is in the way… I'll try to hack around it but it'd be cool if patches started making it in ahead of time.

RyanGlScott commented 5 years ago

Do note that generic-deriving-1.12.3 features a fix for the build error observed in https://github.com/dreixel/generic-deriving/issues/60#issue-402919774.