Klaus (and the rest of the Haskell mailing list),
1) I was surprised that MonadZero does not contain an operation null to
test for the zero monad. The standard monads (lists and the Maybe type)
and usual data structures (queues, ordered sets, ...) could easily
implement this operation. Which other applications were intended?
I don't think we'd been thinking about queues. Interesting idea - I
think I can see what it would look like.
The other popular use of MonadPlus is for parsers - which could also
support a null test.
However, there's no reason to suppose that every monad with plus that
someone might think of in the future will support a null test so I'd
rather leave it out - at least until we have a lot more experience
than we do now.
[Note that the attitude of not assuming we know all possible instances
is kind of new to Haskell. If you try defining your own Num instance,
you'll quickly find that the Num-related class hierarchy is only
really suitable for things that are basically int-like or float-like.]
2) The library proposal does not contain any advanced data structures (yet).
How would one declare, for example, ordered sets as an instance of
Monad[Plus]?
Ordered sets are a problem because constructor classes aren't up to
the job of describing the constraints (Eq, Ord, Ix, Hashable, etc) on
the elements of data structures. The best you can do at the moment is
to use the module system and qualified names to provide libraries with
similarily interfaces. John Peterson and I wrote about this last year
at the Haskell Workshop:
ftp://haskell.cs.yale.edu/pub/haskell/yale/libs-discussion.dvi.gz
ftp://haskell.cs.yale.edu/pub/haskell/yale/libs.dvi.gz
-- draft companion paper which discusses the interface in more detail.
-- note that libs.ps.gz is a MUCH OLDER version of this paper.
(You might also want to download Hugs 1.01 from any of the usual
ftp sites. (eg ftp.cs.nott.ac.uk) It's more or less Haskell 1.2
but does add constructor classes - so you could play around
with those while waiting for a full implementation of Haskell 1.3.)
[...] Can we expect that PreludeList will be replaced with something
different as soon as the library proposal is extended? Will there be
subclasses of MonadPlus?
We hope to keep the Prelude fairly stable but to let the libraries grow
as appropriate. That said, PreludeList is perhaps the most likely to
change in future revisions.
Alastair Reid
Haskell 1.3 Committee