dmjio · GitHub

If template haskell is disabled in monad-logger, this needs to
be propagated to persistent. Otherwise, type errors ensue.

Database/Persist/Sql/Raw.hs:43:18: error:
    • Couldn't match type ‘Control.Monad.Logger.Loc’
                     with ‘Language.Haskell.TH.Syntax.Loc’
      NB: ‘Language.Haskell.TH.Syntax.Loc’
            is defined in ‘Language.Haskell.TH.Syntax’
                in package ‘template-haskell-2.14.0.0’
          ‘Control.Monad.Logger.Loc’
            is defined in ‘Control.Monad.Logger’
                in package ‘monad-logger-0.3.30’
      Expected type: Control.Monad.Logger.Loc
                     -> Control.Monad.Logger.LogSource
                     -> Control.Monad.Logger.LogLevel
                     -> fast-logger-2.4.15:System.Log.FastLogger.LogStr.LogStr
                     -> IO ()
        Actual type: LogFunc
    • In the second argument of ‘runLoggingT’, namely
        ‘(connLogFunc conn)’
      In a stmt of a 'do' block:
        runLoggingT
          (logDebugNS (pack "SQL") $ T.append sql $ pack $ "; " ++ show vals)
          (connLogFunc conn)
      In the expression:
        do runLoggingT
             (logDebugNS (pack "SQL") $ T.append sql $ pack $ "; " ++ show vals)
             (connLogFunc conn)
           getStmtConn conn sql
   |
43 |                 (connLogFunc conn)
   |                  ^^^^^^^^^^^^^^^^
Database/Persist/Sql/Raw.hs:65:10: error:
    • Couldn't match type ‘Control.Monad.Logger.Loc’
                     with ‘Language.Haskell.TH.Syntax.Loc’
      NB: ‘Language.Haskell.TH.Syntax.Loc’
            is defined in ‘Language.Haskell.TH.Syntax’
                in package ‘template-haskell-2.14.0.0’
          ‘Control.Monad.Logger.Loc’
            is defined in ‘Control.Monad.Logger’
                in package ‘monad-logger-0.3.30’
      Expected type: Control.Monad.Logger.Loc
                     -> Control.Monad.Logger.LogSource
                     -> Control.Monad.Logger.LogLevel
                     -> fast-logger-2.4.15:System.Log.FastLogger.LogStr.LogStr
                     -> IO ()
        Actual type: LogFunc
    • In the second argument of ‘runLoggingT’, namely
        ‘(connLogFunc conn)’
      In a stmt of a 'do' block:
        runLoggingT
          (logDebugNS (pack "SQL") $ T.append sql $ pack $ "; " ++ show vals)
          (connLogFunc conn)
      In the expression:
        do conn <- projectBackend `liftM` ask
           runLoggingT
             (logDebugNS (pack "SQL") $ T.append sql $ pack $ "; " ++ show vals)
             (connLogFunc conn)
           stmt <- getStmt sql
           res <- liftIO $ stmtExecute stmt vals
           ....
   |
65 |         (connLogFunc conn)
   |          ^^^^^^^^^^^^^^^^

Note: this change will not affect any code by default, only when the flag is disabled.

Before submitting your PR, check that you've:

After submitting your PR:

  • Update the Changelog.md file with a link to your PR
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)

Read the original on github.com ↗