acid-state / safecopy

An extension to Data.Serialize with built-in version control
60 stars 37 forks source link

Fix compilation with template-haskell-2.15 (GHC-8.8) #76

Closed phadej closed 5 years ago

phadej commented 5 years ago
src/Data/SafeCopy/Derive.hs:246:61: error:
    • Couldn't match expected type ‘[Type]’ with actual type ‘Type’
    • In the second argument of ‘map’, namely ‘ty’
      In the third argument of ‘foldl’, namely ‘(map return ty)’
      In the first argument of ‘worker'’, namely
        ‘(foldl appT (conT tyName) (map return ty))’
    |
246 |               worker' (foldl appT (conT tyName) (map return ty)) context [] (zip [0..] cons)
    |                                                             ^^

src/Data/SafeCopy/Derive.hs:249:61: error:
    • Couldn't match expected type ‘[Type]’ with actual type ‘Type’
    • In the second argument of ‘map’, namely ‘ty’
      In the third argument of ‘foldl’, namely ‘(map return ty)’
      In the first argument of ‘worker'’, namely
        ‘(foldl appT (conT tyName) (map return ty))’
    |
249 |               worker' (foldl appT (conT tyName) (map return ty)) context [] [(0, con)]
    |                                                             ^^

src/Data/SafeCopy/Derive.hs:280:21: error:
    • Couldn't match expected type ‘Type’ with actual type ‘[Type]’
    • In the second argument of ‘(==)’, namely ‘tyIndex’
      In the expression: ty == tyIndex
      In a stmt of a pattern guard for
                     a case alternative:
        ty == tyIndex
    |
280 |             | ty == tyIndex ->
    |                     ^^^^^^^

src/Data/SafeCopy/Derive.hs:281:61: error:
    • Couldn't match expected type ‘[Type]’ with actual type ‘Type’
    • In the second argument of ‘map’, namely ‘ty’
      In the third argument of ‘foldl’, namely ‘(map return ty)’
      In the first argument of ‘worker'’, namely
        ‘(foldl appT (conT tyName) (map return ty))’
    |
281 |               worker' (foldl appT (conT tyName) (map return ty)) context [] (zip [0..] cons)
    |                                                             ^^

src/Data/SafeCopy/Derive.hs:286:21: error:
    • Couldn't match expected type ‘Type’ with actual type ‘[Type]’
    • In the second argument of ‘(==)’, namely ‘tyIndex’
      In the expression: ty == tyIndex
      In a stmt of a pattern guard for
                     a case alternative:
        ty == tyIndex
    |
286 |             | ty == tyIndex ->
    |                     ^^^^^^^

src/Data/SafeCopy/Derive.hs:287:61: error:
    • Couldn't match expected type ‘[Type]’ with actual type ‘Type’
    • In the second argument of ‘map’, namely ‘ty’
      In the third argument of ‘foldl’, namely ‘(map return ty)’
      In the first argument of ‘worker'’, namely
        ‘(foldl appT (conT tyName) (map return ty))’
    |
287 |               worker' (foldl appT (conT tyName) (map return ty)) context [] [(0, con)]
    |  
RyanGlScott commented 5 years ago

I've submitted #77 for the third bullet point.

marco-comini commented 5 years ago

Hi, I don't know what is going on with my system, but I have the strong impression that is not my fault but something wrong with the metadata...

I am using ghc 8.8.1

If I try to install safecopy (without version numbers) it installs safecopy-0.3 (an incredibly old version!)

cabal install --dry-run safecopy In order, the following would be built (use -v for more details):

  • safecopy-0.3 (lib:safecopy) (requires build)

while when I try explicitly the latest version

cabal install --dry-run safecopy-0.10.1 Resolving dependencies... cabal: Could not resolve dependencies: [0] trying: ghc-8.8.1/installed-8.8... (user goal) [1] next goal: safecopy (user goal) [1] rejecting: safecopy-0.10.1 (conflict: ghc => template-haskell==2.15.0.0/installed-2.1..., safecopy => template-haskell<2.15) [1] rejecting: safecopy-0.10.0, safecopy-0.9.4.3, safecopy-0.9.4.2, safecopy-0.9.4.1, safecopy-0.9.4, safecopy-0.9.3.3, safecopy-0.9.3.2, safecopy-0.9.3.1, safecopy-0.9.3, safecopy-0.9.2, safecopy-0.9.1, safecopy-0.9.0.1, safecopy-0.9.0, safecopy-0.8.6, safecopy-0.8.5, safecopy-0.8.4, safecopy-0.8.3, safecopy-0.8.2, safecopy-0.8.1, safecopy-0.8.0, safecopy-0.7.2, safecopy-0.7.1, safecopy-0.7.0, safecopy-0.6.3, safecopy-0.6.2, safecopy-0.6.1, safecopy-0.6.0, safecopy-0.5.1, safecopy-0.5, safecopy-0.4.3, safecopy-0.4.2, safecopy-0.4.1, safecopy-0.4, safecopy-0.3, safecopy-0.2, safecopy-0.1 (constraint from user target requires ==0.10.1) [__1] fail (backjumping, conflict set: ghc, safecopy) After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: safecopy, ghc

ddssff commented 5 years ago

The current version of safecopy does indeed specify template-haskell < 2.15. There is a pull request that adds support but it hasn't been merged yet. Am I mistaken to think that template-haskell-2.15 has never worked with any version of safecopy? (Edit: I added template-haskell < 2.15 to the metadata on hackage.haskell.org recently, but I'm wondering if without that metadata the compile always failed.)

RyanGlScott commented 5 years ago

Am I mistaken to think that template-haskell-2.15 has never worked with any version of safecopy?

As far as I can tell, no released version of safecopy builds with template-haskell-2.15.

There is a pull request that adds support but it hasn't been merged yet.

Speaking of which, is there any reason not to merge #77 at this point?