2013
DOI: 10.1145/2544174.2500602
|View full text |Cite
|
Sign up to set email alerts
|

The constrained-monad problem

Abstract: 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… Show more

Help me understand this report

Search citation statements

Order By: Relevance

Paper Sections

Select...
1
1
1
1

Citation Types

0
4
0

Year Published

2013
2013
2016
2016

Publication Types

Select...
2
2
1

Relationship

2
3

Authors

Journals

citations
Cited by 7 publications
(4 citation statements)
references
References 31 publications
0
4
0
Order By: Relevance
“…• Monad reification: Obsidian uses a simple monad reification technique (observing the underlying structure of a monadic computation) . At the same time, other Embedded Domain Specific Language (EDSL) implementors were also working on monad reification, leading to a number of independent solutions (Persson et al, 2012;Sculthorpe et al, 2013). • Hierarchy-level polymorphism: The hierarchy polymorphism and type-level tagging of operations and arrays are a fairly new addition to Obsidian.…”
Section: Contributionsmentioning
confidence: 99%
“…• Monad reification: Obsidian uses a simple monad reification technique (observing the underlying structure of a monadic computation) . At the same time, other Embedded Domain Specific Language (EDSL) implementors were also working on monad reification, leading to a number of independent solutions (Persson et al, 2012;Sculthorpe et al, 2013). • Hierarchy-level polymorphism: The hierarchy polymorphism and type-level tagging of operations and arrays are a fairly new addition to Obsidian.…”
Section: Contributionsmentioning
confidence: 99%
“…There are also tagless-final DSLs [6], where there is no early commitment to a specific embedding, but instead class overloading in used to specify the API. Several Haskell DSLs, including Feldspar [37] and Obsidian [8], reify the structure of monadic code [40,41] to generate external imperative code. Other DSLs, including CoPilot [38] and Ivory [24], use a shallow embedding of statements to capture the monadic structure.…”
Section: Other Related Workmentioning
confidence: 99%
“…In this section we use the recent constraint kinds GHC extension to generalize to a single deep embedding that can be instantiated to any of the examples. This generalized solution is also available in our Constrained-Normal library [34].…”
Section: Generalizing Using Constraint Kindsmentioning
confidence: 99%
“…Defining a MonadPlus instance for NMP proceeds in a similar manner to the monad and applicative functor cases, so we direct the reader to our Constrained-Normal library [34] for the details. The key step is the application of the left-distribution law ( Figure 6) when an MPlus appears as the first argument to > > =.…”
Section: The Constrained-monadplus Problemmentioning
confidence: 99%