Python-based monads essay part 2
Rustom Mody
rustompmody at gmail.com
Tue Oct 18 06:50:33 EDT 2016
On Tuesday, October 18, 2016 at 4:07:53 PM UTC+5:30, Marko Rauhamaa wrote:
> Chris Angelico wrote:
> > If you want to prove to me that monads are still functional,
>
> Ultimately, monads are simply the pipelining pattern. It is used
> extensively in Unix shells. (I don't know Microsoft's PowerShell, but it
> used to be called "Monad".)
>
> > Otherwise, what you're really saying is "we can cheat until we can do
> > I/O", not "we can do I/O in a functional way".
>
> I guess it's justified as follows: in functional programming, your
> program is a function that produces an output out of its input. IOW:
>
> program(input)
> => output
>
> Because of lazy evaluation, the program can start before the input is
> prepared and output can be returned gradually before the program
> finishes.
This would be an ok view if 'world' consisted of only stdin/stdout
As it happens it consists of files, filesystems, NICs talking to... uh a
more real and somewhat bigger world
Now we can functionalize all this by making 'the world' as a parameter to our functions.
Greg talks of this as do other writings on functional IO
I personally find talking of 'world' as though its an object in my little
world to be a sleight of hand.
OTOH I dont know any better...
More information about the Python-list
mailing list