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

Only call logWarn if there's anything to report #2445

Merged
merged 2 commits into from
Aug 5, 2016

Conversation

istathar
Copy link
Contributor

@istathar istathar commented Aug 5, 2016

As reported in #2418, spurious newlines are being emitted. Doing a git bisect reduced it to a commit which introduced a $logWarn message which seemed responsible. This patch simply wraps the debug statements so that no call is made it the error report is the empty list.

(I leave aside the matter of whether this was a good way to do error reporting; I'm just trying to fix the output bug)

AfC

$logWarn $ mconcat $ map (\(path, entryType) -> "Unexpected entry type " <> entryType <> " for entry " <> T.pack path) unexpectedEntries

F.forM_ unexpectedEntries $ \(path, entryType) ->
logWarnN $ "Unexpected entry type " <> entryType <> " for entry " <> T.pack path
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, stack never uses logWarnN, since it doesn't record source file and position. Otherwise LGTM.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. I didn't know if template haskell would work there. Fixed.

@Blaisorblade Blaisorblade self-assigned this Aug 5, 2016
@Blaisorblade
Copy link
Collaborator

LGTM, I'll merge as soon as tests pass again.

(I leave aside the matter of whether this was a good way to do error reporting; I'm just trying to fix the output bug)

Good question. I used $logWarn just because it seems to be the standard here.
Sorry for the bug and thanks for fixing it so quickly!

@Blaisorblade Blaisorblade merged commit de73854 into commercialhaskell:master Aug 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants