[Xmonad] Re: Xmonad no longer compile since latest darcs pull

Andy Gimblett A.M.Gimblett at swansea.ac.uk
Fri Aug 17 07:45:23 EDT 2007


On Fri, Aug 17, 2007 at 10:38:12AM +0200, Kai Grossjohann wrote:
> 
> The part that I'm having trouble with is monads and the associated
> operators (liftm comes to mind, it seems to be somehow related).  I
> read Hal Daume's tutorial.  Do you have advice what else I can read
> to grok?
>
> (And I'm having trouble to understand the relationship between "<-"
> and "=".  Apparently, "<-" somehow implies that "statements" are
> "executed" in some order.

Sort of, but only really because it gives a name to the result of a
computation, which might get used later (at which point the result
needs to be known, so the computation needs to have been performed).
Order of execution in Haskell is _always_ ultimately decided by data
dependencies - whether you're in a monad or not.

> But Haskell tries really hard to hide the fact that there are
> statements and that there is such as thing as execution.

Well, there aren't statements really, so it doesn't have to try at
all.  ;-)

You might possibly find useful some slides I wrote for a talk I gave
locally about monads.  It's not perfect or the whole story, and will
surely becoming increasingly embarassing to me the more I learn (I'm
already cringing at several parts) - in particular I made the classic
mistake of confusing "I sort of understand the I/O monad" with "I sort
of understand monads".

However, it might help.  It might at least help you get to grips with
the difference between = and <- in do blocks (and when to use each
form - see slide 15), and also liftM (slide 17).  :-)

http://gimbo.org.uk/blog/2007/05/14/a-pragmatic-look-at-monads-in-haskell/

HTH,

-Andy

-- 
Andy Gimblett
Computer Science Department
University of Wales Swansea
http://www.cs.swan.ac.uk/~csandy/


More information about the Xmonad mailing list