Re: [Haskell-cafe] Why monad tutorials don't work

2007-08-14 Thread Dougal Stanton
On 14/08/07, Dan Weston [EMAIL PROTECTED] wrote:

[snips another metaphor for monadic programming]

No offence to Dan, whose post I enjoyed. The concept of wrapping is as
close a metaphor as we seem to get without disagreements. But this has
brought me to a realisation, after Paul Erdos:

The Haskell community is a machine for converting coffee to monad tutorials.

In the spirit of the venture, I will now suggest that someone points
out that they don't like coffee, and that I haven't allowed for arrow
tutorials ;-)

Cheers,

D.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why monad tutorials don't work

2007-08-14 Thread Michael Vanier

snark
As you know, an arrow tutorial is like a wrapper around a monad tutorial, sort of like a container 
around it that can do extra actions with sufficient lifting.  The appropriate higher-order function 
to convert monad tutorials to arrow tutorials will be left as an exercise to the reader.

/snark

I'm becoming more and more convinced that metaphors for monads do more harm than good.  From now on 
I'm going to describe monads as purely abstract entities that obey certain laws, and that _in 
certain instances_ can be viewed to be like containers, or actions, or donuts, or whatever.  In 
other words, a monad is an abstract thing that can generate things that we can metaphorize, but it's 
pointless (point-free?) to try to capture the entire concept in a single metaphor.  I'm reminded of 
a physics teacher who was having a similar problem explaining the concept of tensors, until he said 
that a tensor is something that transforms like a tensor does!.  So a monad is something that 
behaves like a monad does.


Mike (who obviously hasn't had nearly enough coffee today)

Dougal Stanton wrote:

On 14/08/07, Dan Weston [EMAIL PROTECTED] wrote:

[snips another metaphor for monadic programming]

No offence to Dan, whose post I enjoyed. The concept of wrapping is as
close a metaphor as we seem to get without disagreements. But this has
brought me to a realisation, after Paul Erdos:

The Haskell community is a machine for converting coffee to monad tutorials.

In the spirit of the venture, I will now suggest that someone points
out that they don't like coffee, and that I haven't allowed for arrow
tutorials ;-)

Cheers,

D.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why monad tutorials don't work

2007-08-14 Thread Dan Piponi
On 8/14/07, Dan Weston [EMAIL PROTECTED] wrote:
 Conor McBride and Ross Paterson said it best in the introduction to
 their paper Applicative programming with effects [1]:

As von Neumann said: Young man, in mathematics you don't understand
things, you just get used to them.

Getting used to something is, practically by definition, something
that you can't do just by reading the ultimate tutorial. You just have
to write the code, see the pattern happen again and again, and
abstract it. There's no short cut. (Well...sometimes...)

On 8/14/07, Michael Vanier [EMAIL PROTECTED] wrote:
  I'm reminded of
 a physics teacher who was having a similar problem explaining the concept of 
 tensors, until he said
 that a tensor is something that transforms like a tensor does!.

Grrr...must...hold...my...tongue...
--
Dan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why monad tutorials don't work

2007-08-14 Thread Erik Jones
On 8/14/07, Michael Vanier [EMAIL PROTECTED] wrote:

I'm becoming more and more convinced that metaphors for monads do more harm
 than good.  From now on
 I'm going to describe monads as purely abstract entities that obey certain
 laws, and that _in
 certain instances_ can be viewed to be like containers, or actions, or
 donuts, or whatever.  In
 other words, a monad is an abstract thing that can generate things that we
 can metaphorize, but it's
 pointless (point-free?) to try to capture the entire concept in a single
 metaphor.  I'm reminded of
 a physics teacher who was having a similar problem explaining the concept
 of tensors, until he said
 that a tensor is something that transforms like a tensor does!.  So a
 monad is something that
 behaves like a monad does.



Nice.  As a Haskell beginner (with previous imperative programming
experience) I subscribed to this list today to say exactly that.  I spent
weeks reading different tutorials that attempted to enlighten by means of
various abstractions before I finally found one that simply showed the
mechanics of the required operators and rules (sounds less formal than laws)
that they need to hold to.  Even then I hadn't quite got it until I met
SPJ at OSCON and heard myself saying, All monads are are labels in front of
values with specific operations defined on them.  His reply was, Yes!
Very abstract isn't it?  Then I'd got it, or realized that I had but
hadn't realized it (if that makes any sense...), as that sequential exchange
of ideas (hah!) brought me to the realization that the abstractions that
monads are held to represent are solely in the usage semantics of aforesaid
operations and, while technically the actual labels used don't matter, we
pick labels whose meaning match those semantics.

So, yes, don't start by giving any extra meaning to the basic monad
operations than their mechanics.  Then show how they can be use to
implement abstractions like state, uncertainty, etc...

Oh yeah, start with terms that programmers already know, e.g. encapsulation
v. wrappers.  Then switch.  Don't start with terminology that's different
and explain the mappings, start with the familiar than follow the mappings
to the different.

-- 
Erik Jones
[EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why monad tutorials don't work

2007-08-14 Thread Bill Wood
On Tue, 2007-08-14 at 16:02 -0700, Dan Piponi wrote:
   . . .
 On 8/14/07, Michael Vanier [EMAIL PROTECTED] wrote:
   I'm reminded of
  a physics teacher who was having a similar problem explaining the concept 
  of tensors, until he said
  that a tensor is something that transforms like a tensor does!.
 
 Grrr...must...hold...my...tongue...

Dan, as a former student of a clone of that physics teacher, I am really
interested in what you will say when you fail to hold your tongue.

 -- Bill Wood


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe