artisanal software development • 856-419-7654

Monads Explained (for Smart People)

6 • 8 • 17 natesymer


This is the deal: Haskell monads are often misunderstood to the detriment of Haskell projects across the 'net.

The reality is that they are extremely easy to understand when you describe them in plain language: They are wrapped functions that take a context and return some value plus a new context.

Here's a definition for a 'State' monad that implements mutable state:

newtype State s a = State { runState :: s -> (a, s) }

Or more simply:

newtype State s a = State (s -> (a, s))

Let's take a look at a basic computation using the State monad:

On Writing a Blog

5 • 21 • 16 natesymer


UPDATE: most of the cool stuff I talk about I put in the package webapp on the Hackage.

The aspiring blogger uses a blogging platform like WordPress or Blogger to go from zero to blog in under thirty seconds. Most people can't code, and those who can usually want to use someone else's code anyway.

Fine. Use bad software if it makes you happy. Wordpress is a precarious concatenation of bunk so fragile, many devoted users will refuse to host them themselves. Nobody has time to appease Wordpress's byzantine architecture.

© 2017, Nathaniel Symer