freer-simple: Implementation of a friendly effect system for Haskell.

[ bsd3, control, library, program ] [ Propose Tags ]

An implementation of an effect system for Haskell (a fork of freer-effects), which is based on the work of Oleg Kiselyov et al.:

The key features are:

[Skip to Readme]
Versions [RSS] [faq],,,,,,
Change log
Dependencies base (>=4.9 && <5), freer-simple, natural-transformation (>=0.2), template-haskell (>=2.11 && <2.17), transformers-base [details]
License BSD-3-Clause
Copyright (c) 2016 Allele Dev; 2017 Ixperta Solutions s.r.o.; 2017 Alexis King
Author Allele Dev, Ixcom Core Team, Alexis King, and other contributors
Maintainer Alexis King <>
Revised Revision 1 made by lexi_lambda at 2020-05-18T22:52:20Z
Category Control
Home page
Bug tracker
Source repo head: git clone
Uploaded by lexi_lambda at 2019-10-05T00:11:36Z
Distributions LTSHaskell:, NixOS:
Executables freer-examples
Downloads 5071 total (199 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2019-10-05 [all 1 reports]


[Index] [Quick Jump]


Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees


Readme for freer-simple-

[back to package description]

Freer: Extensible Effects with Freer Monads Build Status


The freer-simple library (a fork of freer-effects) is an implementation of an effect system for Haskell, which is based on the work of Oleg Kiselyov et al.:

Much of the implementation is a repackaging and cleaning up of the reference materials provided here.


The key features of freer-simple are:

  • An efficient effect system for Haskell as a library.
  • Implementations for several common Haskell monads as effects:
    • Reader
    • Writer
    • State
    • Trace
    • Error
  • Core components for defining your own Effects.

Example: Console DSL

Here's what using freer-simple looks like:

{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE LambdaCase #-}
module Console where

import Control.Monad.Freer
import Control.Monad.Freer.Error
import Control.Monad.Freer.State
import Control.Monad.Freer.Writer
import System.Exit hiding (ExitCode(ExitSuccess))

                               -- Effect Model --
data Console r where
  PutStrLn    :: String -> Console ()
  GetLine     :: Console String
  ExitSuccess :: Console ()

putStrLn' :: Member Console effs => String -> Eff effs ()
putStrLn' = send . PutStrLn

getLine' :: Member Console effs => Eff effs String
getLine' = send GetLine

exitSuccess' :: Member Console effs => Eff effs ()
exitSuccess' = send ExitSuccess

                          -- Effectful Interpreter --
runConsole :: Eff '[Console, IO] a -> IO a
runConsole = runM . interpretM (\case
  PutStrLn msg -> putStrLn msg
  GetLine -> getLine
  ExitSuccess -> exitSuccess)

                             -- Pure Interpreter --
runConsolePure :: [String] -> Eff '[Console] w -> [String]
runConsolePure inputs req = snd . fst $
    run (runWriter (runState inputs (runError (reinterpret3 go req))))
    go :: Console v -> Eff '[Error (), State [String], Writer [String]] v
    go (PutStrLn msg) = tell [msg]
    go GetLine = get >>= \case
      [] -> error "not enough lines"
      (x:xs) -> put xs >> pure x
    go ExitSuccess = throwError ()


Contributions are welcome! Documentation, examples, code, and feedback - they all help.

Developer Setup

The easiest way to start contributing is to install stack. Stack can install GHC/Haskell for you, and automates common developer tasks.

The key commands are:

  • stack setup — install required version of GHC compiler
  • stack build — builds project, dependencies are automatically resolved
  • stack test — builds project, its tests, and executes the tests
  • stack bench — builds project, its benchmarks, and executes the benchamks
  • stack ghci — start a REPL instance with a project modules loaded
  • stack clean
  • stack haddock — builds documentation

More information about stack can be found in its documentation.


This project is distributed under a BSD3 license. See the included LICENSE file for more details.


The freer-simple package started as a fork of freer-effects by Ixperta Solutions, which in turn is a fork of freer by Allele Dev. All implementations are based on the paper and reference implementation by Oleg Kiselyov. In particular:

There will be deviations from the source.