effectful-plugin: A GHC plugin for improving disambiguation of effects.

[ bsd3, control, library ] [ Propose Tags ] [ Report a vulnerability ]

Instruct GHC to do a better job with disambiguation of effects. . See the README for more information.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 1.0.0.0, 1.1.0.0, 1.1.0.1, 1.1.0.2, 1.1.0.3, 1.1.0.4
Change log CHANGELOG.md
Dependencies base (>=4.14 && <5), containers (>=0.5), effectful-core (>=1.0.0.0 && <3.0.0.0), ghc (>=8.10 && <9.11), ghc-tcplugins-extra (>=0.3 && <0.5) [details]
Tested with ghc ==8.10.7 || ==9.0.2 || ==9.2.8 || ==9.4.8 || ==9.6.5 || ==9.8.2 || ==9.10.1
License BSD-3-Clause
Author Andrzej Rybczak
Maintainer andrzej@rybczak.net
Category Control
Bug tracker https://github.com/haskell-effectful/effectful/issues
Source repo head: git clone https://github.com/haskell-effectful/effectful.git
Uploaded by arybczak at 2024-10-08T18:05:06Z
Distributions LTSHaskell:1.1.0.3, NixOS:1.1.0.3, Stackage:1.1.0.4
Reverse Dependencies 2 direct, 0 indirect [details]
Downloads 785 total (57 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2024-10-08 [all 1 reports]

Readme for effectful-plugin-1.1.0.4

[back to package description]

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.