We (the 1.3 designers) are quite aware of the fact that the monadic
operators (return, >>=, >>, and others) are currently specialized for
a particular monad, IO.  I think we all agree that this is a problem
but within the current Haskell type system there is no alternative.  I
know that both Yale and Chalmers will soon have constructor classes -
I expect Glasgow will too.  Once constructor classes become part of
the language, generalizing these operators will be trivial.  Since
replacing the IO specific versions of these operators by generalized
versions will have no impact on user code we have decided to start
with IO specific operations until the type system is enhanced.

One important thing to remember is that constructor classes would
allow more than the monadic operations to be generalized.  Many
prelude functions are specific to the list data type.  All
of these lists could be generalized to allow things like:

map :: Collection a => (b -> c) -> a b -> a c

Or maybe that should be:

map :: (Collection a, Collection b) => (c -> d) -> a c -> b d

In general, adding a powerful new feature like constructor classes to
the language will require effort to integrate smoothly with the
existing components of the language.  At the moment, the Haskell
community needs to spend a few years working with constructor classes
before we add them to the standard.

  John Peterson
  [EMAIL PROTECTED]

Reply via email to