Plugin and base library to support supermonads in Haskell

Latest on Hackage:

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

BSD3 licensed and maintained by Jan Bracker

Supermonads and superapplicatives for GHC

Implementation of supermonads for GHC. See the Supermonads: One Notion to Bind Them All paper for detailed explanation of version 0.1. An updated version of the paper that also explains superapplicatives has been submitted to JFP.


The library offers two definitions for supermonads. The version in Control.Super.Monad does not have support for constrained monads. The version in Control.Super.Monad.Constrained has support for constrained monads. The different versions are provided, because working with the additional constraints required for constrained monads can be cumbersome sometimes. We want to offer people a possibility to experiment with supermonads without having to bother with these constraints, if they don't need constrained monads. If you have any feedback or suggestions for improvement from you usage of supermonads, please leave them on the GitHub bug tracker or write an email to the maintainer. These parallel structures will not be maintained indefinitely and at some point we will probably only offer supermonads with support for constrained monads.


Support for generalized applicatives was added in version 0.2. For users this does not change anything.

Build Status

master | dev ---------|--------- build status master | build status dev

GHC Version

The implementation has been tested with GHC in version 7.10.3, 8.0.2 and 8.2.1.

Versions of GHC prior to version 7.10.1 will most certainly not work, because the plugin mechanism was still in development.

Newer version of GHC may work. If you encounter problems with a newer version of GHC, please file a bug report so it can be fixed.


To use supermonads in a module you need to do the following:

  • Enable RebindableSyntax in your module by using the LANGUAGE pragma:

    `{-# LANGUAGE RebindableSyntax #-}`

  • Enable the plugin in that modules using the the OPTIONS_GHC pragma:

    `{-# OPTIONS_GHC -fplugin Control.Super.Monad.Plugin #-}`

  • Import the supermonad prelude Control.Super.Monad.Prelude. If you choose to work with constrained monads you will need to import Control.Super.Monad.Constrained.Prelude instead.

  • Make sure to compile the module with the -dynamic flag. This is required for GHC's plugin mechanism to work properly.

Bug Reports

If you file a bug report, please always include the version of GHC you are working with and a minimal example that shows the problem.


Examples for the use of the plugin with different kinds of monad generalizations are provided in the examples directory. All examples have their own separate cabal file and offer a version of the code with and without the use of supermonads.

A minimal example of how to use supermonads can be found under examples/monad/minimal. It is a good entry point to play around with supermonads.


Supermonads package changelog

  • Additional examples of supermonads and superapplicatives.
  • Reference the papers explaining supermonads and -applicatves in the readme.


  • Introduced super-applicatives through the Applicative class. This is a natural broadening of our approach.
  • Renamed the constrained CFunctor to Functor so it can act as a drop in replacement for the standard functor type class.
  • Introduced support for superarrows through the ArrowArr, ArrowSequence, ArrowSelect and ArrowCombine type classes. * Added ebba examples that uses superarrows.
  • Restructure modules to put common plugin code into a module that is not associated with supermonad or superarrows specifically. The old modules are still provided so that people coming from the paper can still rely on those instructions.
  • Fixed effect monad examples by using the new version of the effect-monad package that supports GHC 8+.
  • Generalized and fixed issue with the constrained WrappedMonad instances.


  • Initial release.
Depends on 6 packages:
Used by 1 package:
comments powered byDisqus