effectful-plugin

A GHC plugin for improving disambiguation of effects.

LTS Haskell 24.59:2.0.0.1
Stackage Nightly 2026-09-15:2.2.0.0
Latest on Hackage:2.2.0.0

See all snapshots effectful-plugin appears in

BSD-3-Clause licensed by Andrzej Rybczak
Maintained by [email protected]
This version can be pinned in stack with:effectful-plugin-2.2.0.0@sha256:deef1dbb101f5f494592073477c1ae7749ca71279dbdbf659d70a036cb62dfd3,2282

Module documentation for 2.2.0.0

Depends on 3 packages(full list with versions):
Used by 2 packages in nightly-2026-09-15(full list with versions):

effectful-plugin

A GHC plugin for improving disambiguation of effects.

Usage

To enable the plugin, add the following GHC option to your project file:

ghc-options: -fplugin=Effectful.Plugin

What it does

The following code:

action :: (State Int :> es, State String :> es) => Eff es ()
action = do
  x <- get
  put (x + 1)

will not compile out of the box because GHC doesn’t know that you meant to get an Int since the function + as well as the literal 1 are polymorphic. You have to write:

action :: (State Int :> es, State String :> es) => Eff es ()
action = do
  x <- get @Int
  put (x + 1)

Which is slightly annoying. This plugin tells GHC extra information so code like this can type-check without having to spell types to the compiler.

Acknowledgements

Thanks to Xy Ren for her work on cleff-plugin effectful-plugin is based on.

Changes

effectful-plugin-2.2.0.0 (2026-08-24)

  • Fix a compiler panic when a constraint headed by a type variable or a quantified constraint is considered during candidate filtering.
  • Consider effects from the context as candidates for wanteds with (partially) concrete effect rows instead of silently favouring effects from the row. Genuinely ambiguous cases are now reported as such by GHC, while cases disambiguated by other constraints resolve to the effect that fits. The plugin also no longer commits to the sole candidate when it doesn’t satisfy the remaining constraints, which results in better error messages.
  • Make sure that givens are produced only from effect rows headed by the promoted list constructor.

effectful-plugin-2.1.0.0 (2026-04-02)

  • Drop support for GHC < 9.6.
  • Consider built-in instances when filtering candidates.

effectful-plugin-2.0.0.1 (2025-08-30)

  • Small optimization of checking suitable effects for unification.
  • Add timing flag for tracking execution time of the plugin.
  • Expect wanted constraints that are already solved.

effectful-plugin-2.0.0.0 (2025-06-09)

  • Drop support for GHC < 9.4.
  • Fix various bugs and shortcomings.
  • Add verbose flag for tracing execution of the plugin.

effectful-plugin-1.1.0.4 (2024-10-08)

  • Fix inference in presence of implicit parameters.

effectful-plugin-1.1.0.3 (2024-06-07)

  • Drop support for GHC 8.8.

effectful-plugin-1.1.0.2 (2023-09-13)

  • Add support for GHC 9.8.

effectful-plugin-1.1.0.1 (2023-03-13)

  • Show accurate error message in GHC >= 9.4 if Effectful.Internal.Effect is not found.

effectful-plugin-1.1.0.0 (2023-01-23)

  • Add support for GHC 9.4 and 9.6.

effectful-plugin-1.0.0.0 (2022-07-13)

  • Initial release.