Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Haskell Nomads

Name: Anonymous 2008-09-23 13:47

So can anybody tell me in a way one can understand it what a fucking monad does?

Name: Anonymous 2008-09-23 20:03

Yet another monad explanation.

I know my descriptions are (probably) non-enlightening but I intend to keep everything short; Google will help you find out more.

The only reason why monads have the appearance of complex wizardry is because it is a highly abstract concept and many descriptions use references to the math behind monads. If you're an experienced hacker that uses Haskell, you may have invented monads yourself. http://sigfpe.blogspot.com/2006/08/you-could-have-invented-monads-and.html

A monad is a kind of abstract data type (like a queue or a finite map) with two operations, bind and return, that are supposed to fulfill three mathematical properties. You will go a long way if you keep this in mind when thinking about monads.

Programmers often write code that can be described as "general computation blocks"; some data that has been processed is passed onto some more instructions that perform exactly the same process. Please don't confuse this (admittedly vague and useless) description with recursion or calling a function.

Monads allow programmers to describe "computational strategies" that will input data into the monad, perform the calculation which returns another monad. Writing code in this way allows the programmer to easily combine general computations in a purely functional manner. Another affect is that it allows programmers to "hide" a computation.

An example is a state monad which allows programmers to simulate 'imperative style variables' within a purely functional language.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List