DanBurton / lens-family-th

Template Haskell to generate lenses for lens-family and lens-family-core
BSD 3-Clause "New" or "Revised" License
7 stars 4 forks source link

Compatibility with GHC 9.2 #19

Closed sjakobi closed 2 years ago

sjakobi commented 2 years ago

The upper bound on template-haskell prevents the latest release from building with GHC 9.2. Could you make a new release or a Hackage revision?

sjakobi commented 2 years ago

Actually, this seems to require code changes:

src/Lens/Family/THCore.hs:160:38: error:
    • Couldn't match expected type ‘Pat’
                  with actual type ‘[Pat] -> Pat’
    • Probable cause: ‘pat’ is applied to too few arguments
      In the expression: pat
      In the expression: (pat, expr)
      In an equation for ‘deconstructReconstruct’:
          deconstructReconstruct c nameBase
            = (pat, expr)
            where
                pat = ConP conN (map VarP argNames)
                expr = foldl AppE (ConE conN) (map VarE argNames)
                (conN, nArgs) = getConInfo c
                argNames = mkArgNames nArgs nameBase
    |
160 | deconstructReconstruct c nameBase = (pat, expr) where
    |                                      ^^^

src/Lens/Family/THCore.hs:161:24: error:
    • Couldn't match type ‘Pat’ with ‘Type’
      Expected: Name -> Type
        Actual: Name -> Pat
    • In the first argument of ‘map’, namely ‘VarP’
      In the second argument of ‘ConP’, namely ‘(map VarP argNames)’
      In the expression: ConP conN (map VarP argNames)
    |
161 |   pat = ConP conN (map VarP argNames)
    |                        ^^^^

Head Hackage has a patch though: https://gitlab.haskell.org/ghc/head.hackage/-/blob/master/patches/lens-family-th-0.5.2.0.patch

DanBurton commented 2 years ago

Thanks for the tip! I adapted the patch to suit my own tastes and uploaded it as 0.5.2.1