Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code example for withBackgroundLogger is outdated #156

Closed
ShrykeWindgrace opened this issue Oct 17, 2019 · 1 comment · Fixed by #164
Closed

Code example for withBackgroundLogger is outdated #156

ShrykeWindgrace opened this issue Oct 17, 2019 · 1 comment · Fixed by #164
Assignees
Labels

Comments

@ShrykeWindgrace
Copy link

Compiling the provided usage example fails with

    • Couldn't match expected type ‘LogAction
                                      IO
                                      bytestring-0.10.8.2:Data.ByteString.Lazy.Internal.ByteString’
                  with actual type ‘(LogAction
                                       m1 bytestring-0.10.8.2:Data.ByteString.Internal.ByteString
                                     -> IO r0)
                                    -> IO r0’
    • Probable cause: ‘logger’ is applied to too few arguments
      In the second argument of ‘cmap’, namely ‘logger’
      In the second argument of ‘withBackgroundLogger’, namely
        ‘(Aeson.encode `cmap` logger)’
      In the expression:
        withBackgroundLogger defCapacity (Aeson.encode `cmap` logger)
    • Relevant bindings include
        logger :: forall r.
                  (LogAction
                     m1 bytestring-0.10.8.2:Data.ByteString.Internal.ByteString
                   -> IO r)
                  -> IO r
          (bound at app/Main.hs:13:5)
  |
9 |      (Aeson.encode `cmap` logger)
  |                           ^^^^^^

and

    • Couldn't match type ‘LogAction m0 msg0’ with ‘LoggerT () IO ()’
      Expected type: LogAction m0 msg0 -> IO ()
        Actual type: LoggerT () IO () -> IO ()
    • In the second argument of ‘($)’, namely
        ‘usingLoggerT $ do logMsg "Starting application..."’
      In the expression:
        withBackgroundLogger defCapacity (Aeson.encode `cmap` logger)
          $ usingLoggerT $ do logMsg "Starting application..."
      In an equation for ‘main’:
          main
            = withBackgroundLogger defCapacity (Aeson.encode `cmap` logger)
                $ usingLoggerT $ do logMsg "Starting application..."
            where
                logger = withLogByteStringFile "/var/log/myapp/log"
   |
10 |      $ usingLoggerT $ do
   |        ^^^^^^^^^^^^^^^^^...

Reproducible with aeson and co-log from lts-14.10.

@chshersh chshersh added the doc label Oct 17, 2019
@chshersh
Copy link
Contributor

@ShrykeWindgrace Thanks for opening the issue and providing a detailed error message. We will look into this example and fix it. And we will also try to make this particular example checked, so this never happens again.

@chshersh chshersh added this to the v0.4.0.0: Polishtown milestone Nov 8, 2019
@chshersh chshersh self-assigned this Dec 29, 2019
chshersh added a commit that referenced this issue Dec 29, 2019
chshersh added a commit that referenced this issue Dec 29, 2019
vrom911 pushed a commit that referenced this issue Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants