On Wed, May 20, 2009 at 3:10 PM, bill lam <[email protected]> wrote:
> > The classic example of a monad is Haskell's IO monad, but > > this monad can only be implemented in the language > > infrastructure because ultimately it needs to communicate with the > > outside world and no amount of computation -- purely or impurely > > functional -- can replace communication. > > I don't know what exactly monad is, but there is xmonad - a 'tiling > window manager that rocks' written in haskell. xmonad copys dwm - a > minimalist wm that I currently use. I guess J could also be used to > write a similar wm if someone got time to do it. > > http://www.xmonad.org/ > > <http://www.jsoftware.com/forums.htm> Beware, layman speaking. My theoretical knowledge is severely rusted ;-) And I'm probably misrepresenting everything below. Haskell is mostly (in my eyes) an exercise in Type Theory. Influenced by the whole "theorems as types, proofs as programs" thing. There's some mathematician attached to that idea, whose name eludes me just now. 'Twas all the rage in the late 80's. Since, Haskell tries to be as pure as possible (in terms of typing), side-effects are a big issue. You can't get away with anything that changes the world around you in such a setup. "Luckily", category theory (upon which a lot of type theory is based) has the idea of monads. These allow you to create interesting types, one of which is a state monad (another is the io monad), which allow you to write types that include "stuff", not just plain old arrows etc. But the moment you write a function that makes use of a monadic type, you have to deal with the "stuff"; you now cannot easily get back to the pure idea of referentially transparent functions. They're still functions, but the type system makes sure you don't get into trouble in your reasoning. Robby ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
