Why do we need monads?

Why do we need monads? We want to program only using functions. (“functional programming (FP)” after all). Then, we have a first big problem. This is a program: f(x) = 2 * x g(x,y) = x / y How can we say what is to be executed first? How can we form an ordered sequence … Read more

Large-scale design in Haskell? [closed]

I talk a bit about this in Engineering Large Projects in Haskell and in the Design and Implementation of XMonad. Engineering in the large is about managing complexity. The primary code structuring mechanisms in Haskell for managing complexity are: The type system Use the type system to enforce abstractions, simplifying interactions. Enforce key invariants via … Read more

Monad in plain English? (For the OOP programmer with no FP background)

UPDATE: This question was the subject of an immensely long blog series, which you can read at Monads — thanks for the great question! In terms that an OOP programmer would understand (without any functional programming background), what is a monad? A monad is an “amplifier” of types that obeys certain rules and which has … Read more

A monad is just a monoid in the category of endofunctors, what’s the problem?

That particular phrasing is by James Iry, from his highly entertaining Brief, Incomplete and Mostly Wrong History of Programming Languages, in which he fictionally attributes it to Philip Wadler. The original quote is from Saunders Mac Lane in Categories for the Working Mathematician, one of the foundational texts of Category Theory. Here it is in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)