effectful-plugin

A GHC plugin for improving disambiguation of effects.

Version on this page:1.1.0.3
LTS Haskell 23.1:1.1.0.4@rev:1
Stackage Nightly 2024-12-21:1.1.0.4@rev:1
Latest on Hackage:1.1.0.4@rev:1

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-1.1.0.3@sha256:bae19f701fec98a9ed4f3099744c17aa3297a12f68d752e3b2f8b9ce6cb2bbc1,2611

Module documentation for 1.1.0.3

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-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.