[Haskell-cafe] ANNOUNCE: iterIO-0.1 - iteratee-based IO with pipe operators

dm-list-haskell-cafe at scs.stanford.edu dm-list-haskell-cafe at scs.stanford.edu
Sat May 7 23:15:59 CEST 2011


At Sat, 07 May 2011 21:50:13 +0100,
Maciej Marcin Piechotka wrote:
> 
> Sorry for third post but I wonder why the many instances are restricted
> by Monad.

It would be great if Functor were a superclass of Monad.  However,
since it isn't, and since I can't think of anything particularly
useful to do with Iters over Functors that aren't also Monads, I'd
rather just pass one dictionary around than two.  So my convention
throughout the library is that m has to be a Monad but doesn't have to
be a Functor.

In general, I try to place as few requirements in the contexts of
functions as possible.  However, I also want to be able to call most
functions from most other ones.  If some of the useful low-level
functions end up requiring Functor, then most functions in the library
are going to end up requiring (Functor m, Monad m) => instead of
(Monad m) =>, which will actually end up increasing the amount of
stuff in contexts.

(Of course, (Iter t m) itself is an Applicative Functor, even when m
is just a Monad.  So that I make use of in the parsing module.)

David



More information about the Haskell-Cafe mailing list