effectful/effectful-plugin
Andrzej Rybczak 74da2829fb Update CI
2022-08-03 15:27:44 +02:00
..
src/Effectful Port the plugin from cleff (#66) 2022-06-29 06:41:06 +02:00
tests Port the plugin from cleff (#66) 2022-06-29 06:41:06 +02:00
CHANGELOG.md Release 1.0.0.0 (#67) 2022-07-13 22:05:35 +02:00
effectful-plugin.cabal Update CI 2022-08-03 15:27:44 +02:00
LICENSE Port the plugin from cleff (#66) 2022-06-29 06:41:06 +02:00
README.md Port the plugin from cleff (#66) 2022-06-29 06:41:06 +02:00

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