input-output-hk / plutus-pioneer-program

This repository hosts the lectures of the Plutus Pioneers Program. This program is a training course that the IOG Education Team provides to recruit and train software developers in Plutus, the native smart contract language for the Cardano ecosystem.
1.39k stars 981 forks source link

Failed to build eventful-sql-common-0.2.0 (week 10) #28

Closed hududed closed 3 years ago

hududed commented 3 years ago

at the command cabal run uniswap-pab I get the error at a fresh install of the repo:

src/Eventful/Store/Sql/Orphans.hs:19:21: warning: [-Wdeprecations]
    In the use of data constructor ‘PersistDbSpecific’
    (imported from Database.Persist.Sql, but defined in persistent-2.11.0.4:Database.Persist.Types.Base):
    Deprecated: "Deprecated since 2.11 because of inconsistent escaping behavior across backends. The Postgres backend escapes these values, while the MySQL backend does not. If you are using this, please switch to 'PersistLiteral' or 'PersistLiteralEscaped' based on your needs."
   |
19 |   fromPersistValue (PersistDbSpecific t) =
   |                     ^^^^^^^^^^^^^^^^^
[3 of 5] Compiling Eventful.Store.Sql.Operations ( src/Eventful/Store/Sql/Operations.hs, dist/build/Eventful/Store/Sql/Operations.o, dist/build/Eventful/Store/Sql/Operations.dyn_o )

src/Eventful/Store/Sql/Operations.hs:18:1: warning: [-Wunused-imports]
    The import of ‘maybe’ from module ‘Data.Maybe’ is redundant
   |
18 | import Data.Maybe (listToMaybe, maybe)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Eventful/Store/Sql/Operations.hs:19:1: warning: [-Wunused-imports]
    The import of ‘Data.Monoid’ is redundant
      except perhaps to import instances from ‘Data.Monoid’
    To import instances alone, use: import Data.Monoid()
   |
19 | import Data.Monoid ((<>))
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
[4 of 5] Compiling Eventful.Store.Sql.DefaultEntity ( src/Eventful/Store/Sql/DefaultEntity.hs, dist/build/Eventful/Store/Sql/DefaultEntity.o, dist/build/Eventful/Store/Sql/DefaultEntity.dyn_o )

src/Eventful/Store/Sql/DefaultEntity.hs:25:1: error:
    Generating Persistent entities now requires the MultiParamTypeClasses language extension. Please enable it by copy/pasting this line to the top of your file:

{-# LANGUAGE MultiParamTypeClasses #-}
   |
25 | share [mkPersist sqlSettings, mkMigrate "migrateSqlEvent"] [persistLowerCase|
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
cabal: Failed to build eventful-sql-common-0.2.0 (which is required by
exe:uniswap-pab from plutus-pioneer-program-week10-0.1.0.0). See the build log
above for details.

Unsure how to troubleshoot to solve this.

gergelyhegykozi commented 3 years ago

The error is a pointing to the right direction: MultiParamTypeClasses language extension is required with the newest dependencies. So ghc-options should be extended in the cabal.project file with XMultiParamTypeClasses.

ghc-options: -XDerivingStrategies -XStandaloneDeriving -XUndecidableInstances -XDataKinds -XFlexibleInstances -XMultiParamTypeClasses
hududed commented 3 years ago

Thanks @leonuh, I found my own solution . I havent tried your solution but on the stack exchange link someone also proposed your solution so it'll most likely work too.