Javascript must be enabled to continue!
The constrained-monad problem
View through CrossRef
In Haskell, there are many data types that would form monads were it not for the presence of type-class constraints on the operations on that data type. This is a frustrating problem in practice, because there is a considerable amount of support and infrastructure for monads that these data types cannot use. Using several examples, we show that a monadic computation can be restructured into a normal form such that the standard monad class can be used. The technique is not specific to monads, and we show how it can also be applied to other structures, such as applicative functors. One significant use case for this technique is domain-specific languages, where it is often desirable to compile a deep embedding of a computation to some other language, which requires restricting the types that can appear in that computation.
Association for Computing Machinery (ACM)
Title: The constrained-monad problem
Description:
In Haskell, there are many data types that would form monads were it not for the presence of type-class constraints on the operations on that data type.
This is a frustrating problem in practice, because there is a considerable amount of support and infrastructure for monads that these data types cannot use.
Using several examples, we show that a monadic computation can be restructured into a normal form such that the standard monad class can be used.
The technique is not specific to monads, and we show how it can also be applied to other structures, such as applicative functors.
One significant use case for this technique is domain-specific languages, where it is often desirable to compile a deep embedding of a computation to some other language, which requires restricting the types that can appear in that computation.
Related Results
MoNAD structure and the self-awareness
MoNAD structure and the self-awareness
The authors have been studying a conscious module called Module of Nerves for Advanced Dynamics (MoNAD), which is the core of a conscious robot. The functions of a MoNAD satisfy th...
Uniform Monad Presentations and Graph Quasitoposes
Uniform Monad Presentations and Graph Quasitoposes
Category theory is a field of mathematics that provides a unifying framework for the generalisation of mathematical definitions and theorems, and which has found significant applic...
The Constructive Lift Monad
The Constructive Lift Monad
The lift monad is the construction which to a poset freely adjoins a bottom<br />element to it, or equivalently (from the classical viewpoint), the construction which freely ...
Azumaya Monads and Comonads
Azumaya Monads and Comonads
The definition of Azumaya algebras over commutative rings \(R\) requires the tensor product of modules over \(R\) and the twist map for the tensor product of any two \(R\)-modules....
Labyrinth, Ruin, Junkspace, Monad: dialectical images of the contemporary city
Labyrinth, Ruin, Junkspace, Monad: dialectical images of the contemporary city
The theoretical presupposition of the discourse developed here is Benjamin’s conception of a dialectical image applied to the experience of the modern and contemporary city. The st...
Coalgebraic Infinite Traces and Kleisli Simulations
Coalgebraic Infinite Traces and Kleisli Simulations
Kleisli simulation is a categorical notion introduced by Hasuo to verify finite trace inclusion. They allow us to give definitions of forward and backward simulation for various ty...
On Kleisli liftings and decorated trace semantics
On Kleisli liftings and decorated trace semantics
It is well known that Kleisli categories provide a natural language to model side effects. For instance, in the theory of coalgebras, behavioural equivalence coincides with languag...
Pollinic characterization of Raulinoa echinata R. S. Cowan (Rutaceae), Dyckia brevifolia Baker and Dyckia ibiramensis Reitz (Bromeliaceae), reophyte and saxicolous endemic species of river Itajaí-Açu, Santa Catarina, Brazil
Pollinic characterization of Raulinoa echinata R. S. Cowan (Rutaceae), Dyckia brevifolia Baker and Dyckia ibiramensis Reitz (Bromeliaceae), reophyte and saxicolous endemic species of river Itajaí-Açu, Santa Catarina, Brazil
Aiming to contribute with elements about the reproduction of the reophytes Raulinoa echinata, Dyckia brevifolia and Dyckia ibiramensis as well as to support their taxonomic definit...

