On Tue, Jul 3, 2012 at 5:02 PM, Robert Heumüller <mailing@heum.de> wrote:
Whenever monads apper things seem to get tricky - sadly there won't be
a lecture on functional programming in the next semester at the
university I study at :(

The only trick here is that the text wants to introduce you to monads by doing something that won't work in a normal Haskell; you need to put the compiler in a mode which allows you to in effect rebuild them from scratch.  (You can't simply provide your own definitions because "do" notation is hardwired to use the standard ones anyway, unless you use the RebindableSyntax extension to tell it to use yours.  You'd also have to make sure you don't get the standard definitions, which means NoImplicitPrelude and manually importing Prelude minus the standard machinery.  I don't think RebindableSyntax let you rebind "do" notation properly when that textbook was written, btw, so when it was written *no* Haskell compiler supported the direct use of its examples.)  This was a rather unfortunate choice on Hutton's part, as it means his examples *only* work on paper.

--
brandon s allbery                                      allbery.b@gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms