dreixel / generic-deriving

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

8.8 alpha breakage #61

Closed quasicomputational closed 5 years ago

quasicomputational commented 5 years ago

Input:

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}

module Test where

import Generics.Deriving.TH (deriveAll0)

data family SomeType a b c
data instance SomeType c () a = Nullary
                              | Product String (Maybe Char) a

$(deriveAll0 'Nullary)

This works fine on 8.6, but with the 8.8 alpha this is the result:

Test.hs:15:3: error:
    The exact Name ‘a_axQ’ is not in scope
      Probable cause: you used a unique Template Haskell name (NameU), 
      perhaps via newName, but did not bind it
      If that's it, then -ddump-splices might be useful
   |
15 | $(deriveAll0 'Nullary)

If I comment out the Product constructor, there's a different error - I don't have any idea at all if that's the same bug or if it's a second:

Test.hs:14:3: error:
    • Expecting one more argument to ‘SomeType (c_axO :: ghc-prim-0.5.3:GHC.Types.Type) ()’
      Expected a type, but
      ‘SomeType (c_axO :: ghc-prim-0.5.3:GHC.Types.Type) ()’ has kind
      ‘* -> *’
    • In the first argument of ‘GHC.Generics.Generic’, namely
        ‘(SomeType (c_axO :: ghc-prim-0.5.3:GHC.Types.Type) () :: ghc-prim-0.5.3:GHC.Types.Type)’
      In the instance declaration for
        ‘GHC.Generics.Generic (SomeType (c_axO :: ghc-prim-0.5.3:GHC.Types.Type) () :: ghc-prim-0.5.3:GHC.Types.Type)’
   |
14 | $(deriveAll0 'Nullary)

This was turned up while checking out aeson's 8.8 readiness; it's cut down from one of the test files.

RyanGlScott commented 5 years ago

Yikes, thanks for the bug report! It turns out that this is actually caused by a th-abstraction bug, about which I've opened a ticket here. I'll get out a new release of th-abstraction soon that fixes that bug, and after that I'll double-check to make sure that this bug has disappeared on the generic-deriving side.

RyanGlScott commented 5 years ago

I can confirm that this is fixed with th-abstraction-0.3.1.0.