Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  Re: [Haskell-cafe] The problem with Monads...
      (Henk-Jan van Tuyl)
   2.  Re: [Haskell-cafe] The problem with Monads... (Jonathan Cast)
   3.  RE: [Haskell-cafe] The problem with Monads...
      (Sittampalam, Ganesh)
   4.  RE: [Haskell-cafe] The problem with Monads... (Derek Elkins)
   5.  Re: The problem with Monads... (Benedikt Huber)
   6.  Re: The problem with Monads...
      (Rafael Gustavo da Cunha Pereira Pinto)


----------------------------------------------------------------------

Message: 1
Date: Tue, 13 Jan 2009 22:57:55 +0100
From: "Henk-Jan van Tuyl" <[email protected]>
Subject: Re: [Haskell-beginners] Re: [Haskell-cafe] The problem with
        Monads...
To: "Rafael Gustavo da Cunha Pereira Pinto"
        <[email protected]>,   [email protected],
        [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; format=flowed; delsp=yes;
        charset=iso-8859-15

On Tue, 13 Jan 2009 19:35:57 +0100, Rafael Gustavo da Cunha Pereira Pinto  
<[email protected]> wrote:

> I didn't knew Wadler's papers (I save all papers I read into a external  
> USB
> HD, so I can read them later!), and at a first glance it is really good.
>
>
> Then again, instead of creating another "monad tutorial", what about a
> Haskell monads reference guide, and some worked examples?
>
> Some of this work could even be attached to the library documentation.
>
> Regards
>
> Rafael
>

I have written a reference manual for the basic Haskell monad functions,  
"A Tour of the Haskell Monad functions". It contains a lot of examples.  
You can find it at:
   http://members.chello.nl/hjgtuyl/tourdemonad.html

As far as I know, there is no reference guide for advanced monads, like  
the Reader, Writer and State monads.

-- 
Regards,
Henk-Jan van Tuyl


--
http://functor.bamikanarie.com
http://Van.Tuyl.eu/
--




------------------------------

Message: 2
Date: Tue, 13 Jan 2009 07:51:00 -0800
From: Jonathan Cast <[email protected]>
Subject: [Haskell-beginners] Re: [Haskell-cafe] The problem with
        Monads...
To: Rafael Gustavo da Cunha Pereira Pinto <[email protected]>
Cc: [email protected], [email protected]
Message-ID: <1231861860.17950.1.ca...@jonathans-macbook>
Content-Type: text/plain

On Tue, 2009-01-13 at 12:56 -0200, Rafael Gustavo da Cunha Pereira Pinto
wrote:
> 
> Last night I was thinking on what makes monads so hard to take, and
> came to a conclusion: the lack of a guided tour on the implemented
> monads.

...

> Inspired by the paper "Functional Programming with Overloading and
> Higher-Order Polymorphism",
>         Mark P Jones
> (http://web.cecs.pdx.edu/~mpj/pubs/springschool.html)
>           Advanced School of Functional Programming, 1995.
> 
> SO WHAT?

So have you read Jones' paper?  Or do you have a *concrete* explanation
of how it differs from your desired `guided tour'?

jcc




------------------------------

Message: 3
Date: Tue, 13 Jan 2009 16:22:24 -0000
From: "Sittampalam, Ganesh" <[email protected]>
Subject: [Haskell-beginners] RE: [Haskell-cafe] The problem with
        Monads...
To: "Jonathan Cast" <[email protected]>,        "Rafael Gustavo da
        Cunha Pereira Pinto" <[email protected]>
Cc: [email protected], [email protected]
Message-ID:
        <16442b752a06a74ab4d9f9a5ff076e4b4dc...@elon17p32001a.csfb.cs-group.com>
        
Content-Type: text/plain; charset=us-ascii

Jonathan Cast wrote:
> On Tue, 2009-01-13 at 12:56 -0200, Rafael Gustavo da Cunha Pereira
> Pinto wrote:
>>
>> Inspired by the paper "Functional Programming with Overloading and
>>         Higher-Order Polymorphism", Mark P Jones
>> (http://web.cecs.pdx.edu/~mpj/pubs/springschool.html)
>>           Advanced School of Functional Programming, 1995.
>> 
>> SO WHAT?
> 
> So have you read Jones' paper?  Or do you have a *concrete*
> explanation of how it differs from your desired `guided tour'? 

To give a specific example, a few weeks ago I wanted an explanation of
the 'pass' function and couldn't find it in that paper.

Ganesh

==============================================================================
Please access the attached hyperlink for an important electronic communications 
disclaimer: 

http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================



------------------------------

Message: 4
Date: Tue, 13 Jan 2009 11:27:19 -0600
From: Derek Elkins <[email protected]>
Subject: [Haskell-beginners] RE: [Haskell-cafe] The problem with
        Monads...
To: "Sittampalam, Ganesh" <[email protected]>
Cc: [email protected], Jonathan Cast <[email protected]>,
        Rafael Gustavo da Cunha Pereira Pinto <[email protected]>,
        [email protected]
Message-ID: <1231867639.3917.9.ca...@derek-laptop>
Content-Type: text/plain

On Tue, 2009-01-13 at 16:22 +0000, Sittampalam, Ganesh wrote:
> Jonathan Cast wrote:
> > On Tue, 2009-01-13 at 12:56 -0200, Rafael Gustavo da Cunha Pereira
> > Pinto wrote:
> >>
> >> Inspired by the paper "Functional Programming with Overloading and
> >>         Higher-Order Polymorphism", Mark P Jones
> >> (http://web.cecs.pdx.edu/~mpj/pubs/springschool.html)
> >>           Advanced School of Functional Programming, 1995.
> >> 
> >> SO WHAT?
> > 
> > So have you read Jones' paper?  Or do you have a *concrete*
> > explanation of how it differs from your desired `guided tour'? 
> 
> To give a specific example, a few weeks ago I wanted an explanation of
> the 'pass' function and couldn't find it in that paper.
> 
> Ganesh

Several years ago I documented all the (basic) monads in the mtl on the
(old) wiki.
http://web.archive.org/web/20030927210146/haskell.org/hawiki/MonadTemplateLibrary
In particular,
http://web.archive.org/web/20030907203223/haskell.org/hawiki/MonadWriter


To respond to the essential point of Rafael's initial claim, Wadler's
papers "The Essence of Functional Programming" and/or "Monads for
Functional Programming" have exactly what he wants.  These are the
papers that I recommend to anyone who is learning about monads.
http://homepages.inf.ed.ac.uk/wadler/topics/monads.html

Please, we do not need the 101st monad tutorial when there was an
adequate one made almost two decades ago.  While I'm not saying that
this is the case here, I suspect that many people don't read those
papers because 1) they haven't heard of them and 2) they are "papers"
and thus couldn't possibly be readable and understandable (which also
partially causes (1) as people just don't think to look for papers at
all.)



------------------------------

Message: 5
Date: Wed, 14 Jan 2009 00:07:02 +0100
From: Benedikt Huber <[email protected]>
Subject: [Haskell-beginners] Re: The problem with Monads...
To: Rafael Gustavo da Cunha Pereira Pinto <[email protected]>
Cc: [email protected], haskell <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Rafael Gustavo da Cunha Pereira Pinto schrieb:
> Yes, I've read it twice, and it is a nice explanation that "yes, the 
> reader monad is an application and is a monad". How do I use it? Why not 
> the function itself? How would the plumbing work in a real world example?
Hi Rafael,

First of all, I agree that the documentation for mtl should be improved.
Especially Control.Monad.RWS and Control.Monad.List really need some 
more information.

The documentation for the Reader and Identity monad are quite detailled 
though. They seem to be "inspired" by 
http://www.haskell.org/all_about_monads/, which also has documentation 
on Writer and Cont.

Control.Monad.List is a good example for the lack of documentation:
There is a single sentence at the beginning
 > "The List monad."
and then one declaration
 > newtype ListT m a = ListT { runListT :: m [a] }
while the important information is hidden as one of many instance 
declarations:
 > Monad m => Functor (ListT m)
 > Monad m => MonadPlus (ListT m)

Btw, the quality of the examples in Control.Monad.Reader is debutable. 
 From Example 1:

 > -- The Reader monad, which implements this complicated check.
 > calc_isCountCorrect :: Reader Bindings Bool
 > calc_isCountCorrect = do
 >    count <- asks (lookupVar "count")
 >    bindings <- ask
 >    return (count == (Map.size bindings))

I think it is wrong (or weird at least) to call the function a 'Reader 
monad'; the name 'calc_isCountCorrect' is horrible too (because of the 
calc_ prefix),  Finally, implementing

 > isCountCorrect :: Bindings -> Bool
 > isCountCorrect bs = (bs Map.! "count") == Map.size bs

using the Reader monad will convince everybody _not_ to use it.

A suggestion: If license permits it, short versions of the articles on 
all_about_monads would make a great documentation for mtl (except for 
RWS and List, which are missing).

benedikt


> 
> BTW, the article is really great as an brief introduction to monad 
> transformers. For the whole concept of monads, my all time favorite is 
> "The Haskell Programmer's Guide to the IO Monad" by Stefan Klinger.
> 
> Chapters 14 to 19 of "Real World Haskell" also have a good introduction 
> on the usage of the monads, but it lacks other monads, like the RWS or 
> the Continuation...
> 
> See, that is my point. The mathematical concept of monads is very 
> palatable. The idea that monads are either patterns or structures to 
> hide computations in sequence is also very easy to see. But how do we 
> use them?
> Why should I use a Writer monad when I can use a (a,w) tuple?
> 
> 
> 
> On Tue, Jan 13, 2009 at 13:51, Jonathan Cast <[email protected] 
> <mailto:[email protected]>> wrote:
> 
>     On Tue, 2009-01-13 at 12:56 -0200, Rafael Gustavo da Cunha Pereira Pinto
>     wrote:
>      >
>      > Last night I was thinking on what makes monads so hard to take, and
>      > came to a conclusion: the lack of a guided tour on the implemented
>      > monads.
> 
>     ...
> 
>      > Inspired by the paper "Functional Programming with Overloading and
>      > Higher-Order Polymorphism",
>      >         Mark P Jones
>      > (http://web.cecs.pdx.edu/~mpj/pubs/springschool.html
>     <http://web.cecs.pdx.edu/%7Empj/pubs/springschool.html>)
>      >           Advanced School of Functional Programming, 1995.
>      >
>      > SO WHAT?
> 
>     So have you read Jones' paper?  Or do you have a *concrete* explanation
>     of how it differs from your desired `guided tour'?
> 
>     jcc
> 
> 
> 
> 
> 
> -- 
> Rafael Gustavo da Cunha Pereira Pinto
> Electronic Engineer, MSc.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Haskell-Cafe mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/haskell-cafe



------------------------------

Message: 6
Date: Wed, 14 Jan 2009 08:02:20 -0200
From: "Rafael Gustavo da Cunha Pereira Pinto"
        <[email protected]>
Subject: [Haskell-beginners] Re: The problem with Monads...
To: "Benedikt Huber" <[email protected]>
Cc: [email protected], haskell <[email protected]>
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

Wadler's examples are way better than the ones in the documentation. But
without his explanations of what he is doing, the examples alone are pretty
worthless.

I agree that all_about_monads could be a better source for the
documentation, at least for completeness. But even there I would consider
choosing simpler examples, like Wadler's expression evaluator.




On Tue, Jan 13, 2009 at 21:07, Benedikt Huber <[email protected]> wrote:

> Rafael Gustavo da Cunha Pereira Pinto schrieb:
>
>> Yes, I've read it twice, and it is a nice explanation that "yes, the
>> reader monad is an application and is a monad". How do I use it? Why not the
>> function itself? How would the plumbing work in a real world example?
>>
> Hi Rafael,
>
> First of all, I agree that the documentation for mtl should be improved.
> Especially Control.Monad.RWS and Control.Monad.List really need some more
> information.
>
> The documentation for the Reader and Identity monad are quite detailled
> though. They seem to be "inspired" by
> http://www.haskell.org/all_about_monads/, which also has documentation on
> Writer and Cont.
>
> Control.Monad.List is a good example for the lack of documentation:
> There is a single sentence at the beginning
> > "The List monad."
> and then one declaration
> > newtype ListT m a = ListT { runListT :: m [a] }
> while the important information is hidden as one of many instance
> declarations:
> > Monad m => Functor (ListT m)
> > Monad m => MonadPlus (ListT m)
>
> Btw, the quality of the examples in Control.Monad.Reader is debutable. From
> Example 1:
>
> > -- The Reader monad, which implements this complicated check.
> > calc_isCountCorrect :: Reader Bindings Bool
> > calc_isCountCorrect = do
> >    count <- asks (lookupVar "count")
> >    bindings <- ask
> >    return (count == (Map.size bindings))
>
> I think it is wrong (or weird at least) to call the function a 'Reader
> monad'; the name 'calc_isCountCorrect' is horrible too (because of the calc_
> prefix),  Finally, implementing
>
> > isCountCorrect :: Bindings -> Bool
> > isCountCorrect bs = (bs Map.! "count") == Map.size bs
>
> using the Reader monad will convince everybody _not_ to use it.
>
> A suggestion: If license permits it, short versions of the articles on
> all_about_monads would make a great documentation for mtl (except for RWS
> and List, which are missing).
>
> benedikt
>
>
>
>> BTW, the article is really great as an brief introduction to monad
>> transformers. For the whole concept of monads, my all time favorite is "The
>> Haskell Programmer's Guide to the IO Monad" by Stefan Klinger.
>>
>> Chapters 14 to 19 of "Real World Haskell" also have a good introduction on
>> the usage of the monads, but it lacks other monads, like the RWS or the
>> Continuation...
>>
>> See, that is my point. The mathematical concept of monads is very
>> palatable. The idea that monads are either patterns or structures to hide
>> computations in sequence is also very easy to see. But how do we use them?
>> Why should I use a Writer monad when I can use a (a,w) tuple?
>>
>>
>>
>> On Tue, Jan 13, 2009 at 13:51, Jonathan Cast 
>> <[email protected]<mailto:
>> [email protected]>> wrote:
>>
>>    On Tue, 2009-01-13 at 12:56 -0200, Rafael Gustavo da Cunha Pereira
>> Pinto
>>    wrote:
>>     >
>>     > Last night I was thinking on what makes monads so hard to take, and
>>     > came to a conclusion: the lack of a guided tour on the implemented
>>     > monads.
>>
>>    ...
>>
>>     > Inspired by the paper "Functional Programming with Overloading and
>>     > Higher-Order Polymorphism",
>>     >         Mark P Jones
>>     > 
>> (http://web.cecs.pdx.edu/~mpj/pubs/springschool.html<http://web.cecs.pdx.edu/%7Empj/pubs/springschool.html>
>>    <http://web.cecs.pdx.edu/%7Empj/pubs/springschool.html>)
>>     >           Advanced School of Functional Programming, 1995.
>>     >
>>     > SO WHAT?
>>
>>    So have you read Jones' paper?  Or do you have a *concrete* explanation
>>    of how it differs from your desired `guided tour'?
>>
>>    jcc
>>
>>
>>
>>
>>
>> --
>> Rafael Gustavo da Cunha Pereira Pinto
>> Electronic Engineer, MSc.
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
>


-- 
Rafael Gustavo da Cunha Pereira Pinto
Electronic Engineer, MSc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20090114/d20383dc/attachment.htm

------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 7, Issue 11
****************************************

Reply via email to