Monday, May 13, 2013

C# and Monads

Good articles to start from:

Mike Hadlow - nice video, I'd say, required to start from this video.
http://vimeo.com/21705972 from Mike's presentation on E-VAN 2011. I think this is best explanation to C# then all other articles.
At the end of presentation Mike compares Task with async/await to the monads: async/await is kind of syntax sugar for just one type - Task and supports control statements (if, loops, etc); Monads in general in C# do not have support for control statements (unless create Bind() ? functions to cover them? even if possible, I think code will look really strange after that)

Anyway more links:
http://mikehadlow.blogspot.com/2011/03/monads-european-virtual-altnet-video-is.html
http://mikehadlow.blogspot.com/2011/01/monads-in-c1-introduction.html - 8 articles. Pretty easy to follow.

Wesdyer (from C# lang team in MS)
http://blogs.msdn.com/b/wesdyer/archive/2008/01/11/the-marvels-of-monads.aspx
This is probably "original" post for C# and Monads. It has example of these monads: Identity, MayBe, List and Continuation. Continuation is Monad with no data but to combine operations.

Wesdyer has many mind twisting articles: http://blogs.msdn.com/b/wesdyer/archive/2007/02/02/anonymous-recursion-in-c.aspx


Eric Lippert has http://ericlippert.com/category/monads/ series of posts on Monads in C#.

One more: http://codebetter.com/matthewpodwysocki/2008/10/13/functional-c-linq-as-a-monad/
Compares implementation of Identity, MayBe, List and Asynchronous monads in C# and F#.

No comments: