[Haskell-cafe] Monad transformer responsibilities
Martijn van Steenbergen
martijn at van.steenbergen.nl
Fri Jun 5 05:54:00 EDT 2009
Hello,
Suppose I have two projects: 1) one that defines a monad transformer and
an accompanying type class that captures my monad-specific operations
and 2) one that uses the other project, combining the monad transformer
with, say, Parsec.
Now while writing my Parsec parser I want to use my monad transformer
operations without using lift: I need an instance MyMonadT Parsec. Where
should this instance go? I can think of three answers, all unsatisfactory:
1) For obvious reasons it shouldn't go in the Parsec package.
2) For pretty much the same reasons it shouldn't go in my monad
transformer package, either. Also, it is undesirable to add a dependency
on Parsec just for this instance, and the package should not have to
know about the projects that are going to use it.
3) If I put it in the second project it is an orphan instance, which is
undesirable for well-known reasons.
What is the best solution?
Thank you,
Martijn.
More information about the Haskell-Cafe
mailing list