stacked: A modern indexed monad stack

[ library, mit, unclassified ] [ Propose Tags ] [ Report a vulnerability ]

Please see README.md.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0, 0.1.1
Dependencies base (>=4.19 && <4.22), comonad [details]
License MIT
Copyright (c) Modus Create LLC and its affiliates
Author Arnaud Spiwack
Maintainer arnaud.spiwack@tweag.io
Uploaded by aspiwack at 2026-01-08T08:15:43Z
Home page https://github.com/tweag/stacked#readme
Bug tracker https://github.com/tweag/stacked/issues
Source repo head: git clone https://github.com/tweag/stacked
Distributions NixOS:0.1.0
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 15 total (7 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2026-01-08 [all 1 reports]

Readme for stacked-0.1.1

[back to package description]

Stacked

The modern indexed monad stack

Stacked is an indexed monad (see e.g. this description by Conor McBride) library built from the ground up to use modern GHC features (such as qualified do and quantified constraints).

For instance

  • The monad hierarchy follows that of base with for instance Applicative and Monad. These don't use distinctive names IxApplicative, IxMonad, or ixBind: they use the standard Applicative, Monad, and (>>=) names from base, and are meant to be imported qualified, and typically use with the qualified do notation.
  • But there is no indexed functor class defined in this library because, thanks to quantified constraints, the standard functor class suffices. The functor super-class for indexed applicative looks like (forall i j. Functor f i j) => …
  • We also take the opportunity of growing the stack from scratch to define a single Additive class to replace Alternative and MonadPlus. We then define Alternative as
    type Alternative m = (Applicative m, forall r r' a. Additive (m r r' a))
    
    Which uses both quantified constraints and impredicative types.

The library is meant to feel familiar to Haskell programmers, despite the clean-ups that modern Haskell affords.

Points of interest

  • Stacked has a rich sublibrary on continuation indexed monads and their relation with delimited control. This part of the library was developed to serve the needs of the Pup library.