pinned-warnings: Preserve warnings in a GHCi session

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Please see the README on GitHub at https://github.com/aaronallen8455/pinned-warnings#readme


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 0.1.0.5, 0.1.0.6, 0.1.0.7, 0.1.0.8, 0.1.0.9, 0.1.0.10, 0.1.0.11, 0.1.0.11, 0.1.0.12, 0.1.0.13, 0.1.0.14, 0.1.0.15, 0.1.1.0, 0.1.2.0
Change log CHANGELOG.md
Dependencies base (>=4.14.1 && <5), bytestring (>=0.10.12), containers (>=0.6.2), directory (>=1.3.6), ghc (>=8.10 && <9.3), time (>=1.9.3), transformers (>=0.5.6 && <0.6) [details]
License BSD-3-Clause
Copyright 2021 Aaron Allen
Author Aaron Allen
Maintainer aaronallen8455@gmail.com
Category Utility, Development
Home page https://github.com/aaronallen8455/pinned-warnings#readme
Bug tracker https://github.com/aaronallen8455/pinned-warnings/issues
Uploaded by aaronallen8455 at 2022-08-10T14:21:54Z

Modules

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for pinned-warnings-0.1.0.11

[back to package description]

Pinned Warnings

The problem

When working in GHCi, it's easy to lose track of warnings from modules other than the one you are currently editing. Having to reload the project to catch any warnings you might have missed is painful.

The solution

This package has a GHC plugin that allows you to see all the current warnings from all modules in GHCi by calling a special showWarnings function.

Usage

You can start GHCi in your project with one of the following commands to enable the necessary plugin. Add pinned-warnings as a package dependency to avoid having to include the additional argument.

cabal update
cabal new-repl -b pinned-warnings --repl-options="-fplugin PinnedWarnings"

stack update
stack repl --package pinned-warnings --ghci-options "-fplugin PinnedWarnings"

Then you must add the ShowWarnings module to the GHCi context:

:m + ShowWarnings

Now all active warnings can be viewed by evaluating showWarnings.

Tip

You can define a custom GHCi command in your .ghci file that adds the ShowWarnings module and calls showWarnings:

:def sw (\_ -> pure ":m + ShowWarnings \n showWarnings")

With this you can simply use :sw to view warnings.

Fixing warnings

There is limited functionality for automatically fixing warnings. Currently only warnings due to redundant module import statements are corrected but there is room for improvement in this regard.

To use this functionality, have the ShowWarnings module added to your GHCi session then evaluate fixWarnings.

Known limitations