[Haskell] ANN: monadLib 2.0
Bulat Ziganshin
bulat.ziganshin at gmail.com
Wed Mar 22 08:20:35 EST 2006
Hello Iavor,
Tuesday, March 21, 2006, 9:38:06 PM, you wrote:
>> whenM :: Monad m => m Bool -> m a -> m ()
ID> One thing about 'whenM' however is that to implement it I'll need to
ID> add an extra
ID> 'return ()' to the parameter computation. This is probably not a big deal, but
ID> given that most of the time the computation used in 'whenM' is already
ID> of type 'm ()', I wonder if leaving it to the programmer to add the
ID> 'return ()' is not a better idea.
ID> What do you think?
that is a sort of thing that bother me constantly. `when` has the same
problem. i as application programmer want to write less unnecessary code
ID> Note however that 'monadLib' is not a drop in replacement for 'mtl',
ID> as other things differ as well, for example 'monadLib' has a different
ID> monad class hierarchy.
class hierarchy don't matter for application programs in most cases.
may be it's better to have "mtl emulation module" and give it (in ghc
6.6) the same name as mtl module has currently. so new apps will use
your library directly and other apps will use it through emulation. i
use the same technique for my own Binary-replacing module
>> deriving Typeable for everything would be good too.
ID> I have never used 'Typeable', but perhaps I will take a look. I would
ID> like 'monadLib' to stay simple, but if people use 'Typeable' on
ID> monadic computations I could probably add some instances. Are there
ID> any examples of when it is useful to do things like that? Does Hugs
ID> support Typeable?
i think that support for Typeable in any library is a "good form" now,
like support for monads itself :)
>> Also, it looks like some of your monads overlap with what is provided by
>> the Applicative (Idiom) and friends classes to be included in the next
>> version of ghc, perhaps you can make a version of monadLib that builds
>> on those?
ID> I am aware of that, and once they are released I will probably make
ID> use of them, because I think that they have some nice ideas. In the
ID> mean time however 'monadLib' provides 'Monad.ForEach' and
ID> 'Monad.Combinators'.
i think that it's better not to wait while they will be released, but
after your MonadLib will be stabilized, propose to include it in 6.6
and develop version of lib that is compatible with 6.6 (if your
library goal is to replace mtl)
--
Best regards,
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Libraries
mailing list