Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^2: Functional programming ?

by tilly (Archbishop)
on Apr 17, 2009 at 05:17 UTC ( #758127=note: print w/replies, xml ) Need Help??

in reply to Re: Functional programming ?
in thread Functional programming ?

I suspect that few understand monads well enough to get your analogy.

The short explanation is that in pure functional programming, every time you call a function with a fixed set of arguments, you must get the same response back. But if you do I/O, you want it to do a different thing each time. Monads are used to solve this problem by creating a container that will be a different argument each and every time you call the function, which therefore makes it OK to get different results back. In the above analogy, therefore, the truck is the monad. And every time you make a delivery, you need a different truck.

Monads can be used for other things as well, but this is the one that first confronts anyone learning Haskell.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://758127]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2022-05-24 03:03 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (82 votes). Check out past polls.