[project @ 2003-06-04 14:52:09 by ralf]
[haskell-directory.git] / Control / Monad / X / README
1 This is an experimental replacement for the current monad library.
2 (at some point the .X. part of the names should disappear)
3
4 It is mostly complete, but some more work is needed in places,
5 in particular the interaction of continuations with other features.
6 also a lot more tests/laws are need.  and of course documentation.
7
8 Resumptions are very new and not well tested.  Also the nonstandard
9 morphisms for them are not fixed.
10
11 Changes from the original library
12 =================================
13
14 General:
15   * the monads are implemented in terms of the transformers
16     - the transformer files end in "T"
17     - the monad files have no "T" at the end
18     - a monad file defines a type synonym, and redefines the "run" functions.
19   * The file Transformers imports all transformers
20   * The file Monads imports all monads and fix, and so everything in the library
21     (it is note very useful except for compiling the library)
22   * Currently there is no ListT, instead we have NondetT,
23     which is (kind of) based on what's in Ralf Hinze's 
24     "Deriving Monad Transformers" paper.
25   * there is no RWS transformer
26   * NondetT transformer is new
27   * ResumeT is new
28   * New class HasBaseMonad to perform computations in the "heart" of the monad
29   * structural changes in the code
30     - tried to capture common patterns in definitions
31     - the library is currently in "column" format, i.e.
32       a file for a transformer contains:
33         - basic instances (Functor, Monad, HasBaseMonad)
34         - arbitrary functions (mostly from old library) things like "run" etc.
35         - liftings of all features only for this transformer
36
37     - the file "Fix" is in "row" format, i.e. it implements "mfix" for all transformers.
38   * MonadPlus is used for backtracking and _not_ error handling
39   * none of the transformers implement "fail" it is just passed along to the base monad,
40     thus: fail x = inBase (fail x)
41     - reason for that is that there seems to be no reasonable way to implement it
42
43   
44 Specific:
45
46 Reader: new function runReader (like runReadrT with swapped arguments)  
47 Writer: * new function runWriter (same as runWriterT)
48         * new behavior for "listen": it does not produce any output
49           thus: oldListen m = do (a,w) <- listen m
50                                  tell w
51         * moved "pass" out of the class (implemented in terms of the other functions)
52 State:  * new functions runState (like evalState with swapped arguments)
53                         runStateS (like runStateT with swapped arguments)
54 Error:  * new function runError (same as runErrorT)
55         * removed Error class, now errors can be of any type
56         * fail "" does _not_ cause an error to be thrown  (see comments above)
57         * mzero does _not_ cause an error to be thrown  (see comments above)
58         * mplus does _not_ handle errors (see comments above)
59 Nondet: new
60 Resume: new
61 Cont:   unfinished
62           - how to do "local" (current seems reasonable, but deviates from "standard" definitions)
63           - how to do "listen"
64           - understand better interaction with other control transformers
65             (exceptions, resumptions, nondeterminism)
66
67
68 People
69 ======
70
71 discussions etc should probably be sent to:
72 libraries@haskell.org
73
74 author of current version:  Iavor S. Diatchki <mailto:diatchki@cse.ogi.edu>
75 based upon the original by: Andy Gill <mailto:andy@cse.ogi.edu>
76 the ErrorT in the original library was rendered by: Michael Weber <mailto:michael.weber@post.rwth-aachen.de>
77 the initial version of the NondetT code in CPS style was from: Andrew J Bromage <mailto:ajb@spamcop.net>
78
79 iavor: if i forgot someone (sorry!) please send me email 
80