Python-based monads essay part 2

Chris Angelico rosuav at gmail.com
Tue Oct 18 05:24:51 EDT 2016


On Fri, Oct 14, 2016 at 9:52 AM, Gregory Ewing
<greg.ewing at canterbury.ac.nz> wrote:
> A bit more on SMFs, and then some I/O.
>
> http://www.cosc.canterbury.ac.nz/greg.ewing/essays/monads/DemystifyingMonads2.html

Finally finished reading this - it's been up in a tab in Chrome for
the past few days.

So here's how I summarize your explanation of monads:

1) Functional programming can describe states and transitions.
2) We can cheat with those by hiding the states and implementing
things imperatively.
3) Once we're already implementing things imperatively, we can do I/O.

If you want to prove to me that monads are still functional, *REVERSE*
your transformation in the original article. You can take your
original set-builder monad and turn it into genuinely functional code;
show me that you can do the same with I/O. 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".

ChrisA



More information about the Python-list mailing list