lykahb / groundhog

This library maps datatypes to a relational model, in a way similar to what ORM libraries do in OOP. See the tutorial https://www.schoolofhaskell.com/user/lykahb/groundhog for introduction
http://hackage.haskell.org/package/groundhog
176 stars 39 forks source link

Unable to build ground-th with ghc 8.2.1: Couldn't match type ‘Type’ with ‘DerivClause’ #68

Closed DougBurke closed 7 years ago

DougBurke commented 7 years ago

Using

% ghc --versionThe Glorious Glasgow Haskell Compilation System, version 8.2.1

I get the following error when run from the ground-th directory:

% cabal new-build
Resolving dependencies...
In order, the following will be built (use -v for more details):
groundhog-0.8
yaml-0.8.23.3
groundhog-th-0.8
Configuring groundhog-0.8...
Configuring yaml-0.8.23.3...
Building groundhog-0.8...
Building yaml-0.8.23.3...
Configuring groundhog-th-0.8...
Preprocessing library groundhog-th-0.8...
[1 of 3] Compiling Database.Groundhog.TH.Settings ( Database/Groundhog/TH/Settings.hs, /home/djburke/chandraobs/groundhog/groundhog-th/dist-newstyle/build/groundhog-th-0.8/build/Database/Groundhog/TH/Settings.o )
[2 of 3] Compiling Database.Groundhog.TH.CodeGen ( Database/Groundhog/TH/CodeGen.hs, /home/djburke/chandraobs/groundhog/groundhog-th/dist-newstyle/build/groundhog-th-0.8/build/Database/Groundhog/TH/CodeGen.o )

Database/Groundhog/TH/CodeGen.hs:826:45: error:
    • Couldn't match type ‘Type’ with ‘DerivClause’
      Expected type: [DerivClause]
        Actual type: [Type]
    • In the sixth argument of ‘DataInstD’, namely ‘(map ConT derives)’
      In the expression:
        DataInstD cxt name types Nothing constrs (map ConT derives)
      In an equation for ‘dataInstD'’:
          dataInstD' cxt name types constrs derives
            = DataInstD cxt name types Nothing constrs (map ConT derives)
    |
826 |   DataInstD cxt name types Nothing constrs (map ConT derives)
    |                                             ^^^^^^^^^^^^^^^^

Database/Groundhog/TH/CodeGen.hs:834:41: error:
    • Couldn't match type ‘Type’ with ‘DerivClause’
      Expected type: [DerivClause]
        Actual type: [Type]
    • In the sixth argument of ‘DataD’, namely ‘(map ConT derives)’
      In the expression:
        DataD cxt name types Nothing constrs (map ConT derives)
      In an equation for ‘dataD'’:
          dataD' cxt name types constrs derives
            = DataD cxt name types Nothing constrs (map ConT derives)
    |
834 |   DataD cxt name types Nothing constrs (map ConT derives)
    |                                         ^^^^^^^^^^^^^^^^
lykahb commented 7 years ago

Thank you for the report. I don't have the recent GHC yet. Can you test if the branch template212 fixes this?

DougBurke commented 7 years ago

It now builds (warnings shown below, but lacking the full-color spectacle that ghc 8.2.1 now creates :-). Thanks. Is there a good way to test it? I should add lack of support for 8.2.1 is not a problem for me just now, I was just checking.

% cabal new-build
Resolving dependencies...
In order, the following will be built (use -v for more details):
groundhog-th-0.8
Configuring groundhog-th-0.8...
Preprocessing library groundhog-th-0.8...
[1 of 3] Compiling Database.Groundhog.TH.Settings ( Database/Groundhog/TH/Settings.hs, /home/djburke/chandraobs/groundhog/groundhog-th/dist-newstyle/build/groundhog-th-0.8/build/Database/Groundhog/TH/Settings.o )
[2 of 3] Compiling Database.Groundhog.TH.CodeGen ( Database/Groundhog/TH/CodeGen.hs, /home/djburke/chandraobs/groundhog/groundhog-th/dist-newstyle/build/groundhog-th-0.8/build/Database/Groundhog/TH/CodeGen.o )

Database/Groundhog/TH/CodeGen.hs:32:1: warning: [-Wunused-imports]
    The import of ‘Control.Applicative’ is redundant
      except perhaps to import instances from ‘Control.Applicative’
    To import instances alone, use: import Control.Applicative()
   |
32 | import Control.Applicative
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^

Database/Groundhog/TH/CodeGen.hs:824:12: warning: [-Wname-shadowing]
    This binding for ‘cxt’ shadows the existing binding
      imported from ‘Language.Haskell.TH’ at Database/Groundhog/TH/CodeGen.hs:30:1-26
      (and originally defined in ‘Language.Haskell.TH.Lib’)
    |
824 | dataInstD' cxt name types constrs derives =
    |            ^^^

Database/Groundhog/TH/CodeGen.hs:834:8: warning: [-Wname-shadowing]
    This binding for ‘cxt’ shadows the existing binding
      imported from ‘Language.Haskell.TH’ at Database/Groundhog/TH/CodeGen.hs:30:1-26
      (and originally defined in ‘Language.Haskell.TH.Lib’)
    |
834 | dataD' cxt name types constrs derives =
    |        ^^^
[3 of 3] Compiling Database.Groundhog.TH ( Database/Groundhog/TH.hs, /home/djburke/chandraobs/groundhog/groundhog-th/dist-newstyle/build/groundhog-th-0.8/build/Database/Groundhog/TH.o )

Database/Groundhog/TH.hs:368:21: warning: [-Wincomplete-patterns]
    Pattern match(es) are non-exhaustive
    In a case alternative:
        Patterns not matched:
            (GadtC _ _ _)
            (RecGadtC _ _ _)
    |
368 |   mkConstr cNum c = case c of
    |                     ^^^^^^^^^...

Database/Groundhog/TH.hs:392:16: warning: [-Wincomplete-patterns]
    Pattern match(es) are non-exhaustive
    In a case alternative:
        Patterns not matched:
            (GadtC _ _ _)
            (RecGadtC _ _ _)
    |
392 |     [cons'] -> case cons' of
    |                ^^^^^^^^^^^^^...

Database/Groundhog/TH.hs:411:13: warning: [-Wname-shadowing]
    This binding for ‘dName’ shadows the existing binding
      bound at Database/Groundhog/TH.hs:409:3
    |
411 |     DataD _ dName _ _ _ _ -> dName
    |             ^^^^^

Database/Groundhog/TH.hs:412:16: warning: [-Wname-shadowing]
    This binding for ‘dName’ shadows the existing binding
      bound at Database/Groundhog/TH.hs:409:3
    |
412 |     NewtypeD _ dName _ _ _ _ -> dName
    |                ^^^^^

Database/Groundhog/TH.hs:656:3: warning: [-Wname-shadowing]
    This binding for ‘d’ shadows the existing binding
      bound at Database/Groundhog/TH.hs:650:11
    |
656 |   d -> error $ "Only datatypes can be processed: " ++ show d
    |   ^
Creating package registration file:
/home/djburke/chandraobs/groundhog/groundhog-th/dist-newstyle/tmp/package-registration-13651805401540383426
DougBurke commented 7 years ago

I can build groundhog-th-0.8.0.1 using ghc 8.2.1 now. Thanks.