ezyang’s blog

the arc of software bends towards understanding

Use The Monoid: A worked example

Attention conservation notice. Equivalent Haskell and Python programs are presented for retrieving values from a data structure using state. We then refactor the Haskell program into one that has no state, just a monoid. A pretty frequent thing a working programmer needs to do is extract some values (frequently more than one) from some data […]

  • May 28, 2010