• Lenses for Tree Traversals Redux

    Previously I wrote about how you can use explicit Traversals from lens to simplify some aspects of tree manipulation. I recently had another win using this, so here’s another case study! It also provides a better example for when you want to fold over things than the previous post had.

    Read on →

  • On Commenting Code

    Programmers like to go on about how you should or should not comment your code. This is my contribution. But first, go read Antirez’s take on this which is fantastic and says almost everything that needs to be said, I agree with essentially all of it.

    Read on →

  • Four lenses on the upsides of bad behaviour

    I’ve been reading quite a few psychiatric/therapeutic/self-help books recently. This post is some notes on a common thread I noticed in a few of them about the positive sides of “bad” behaviours.

    Read on →

  • Elementary programming

    What’s the difference between this program

    mapMaybe :: (a -> Maybe b) -> [a] -> Maybe [b]
    mapMaybe f [] = Just []
    mapMaybe f (a:as) = (:) <$> f a <*> mapMaybe f as 
    

    and this one?

    mapMaybe :: (a -> Maybe b) -> [a] -> Maybe [b]
    mapMaybe = traverse
    

    The second one is certainly shorter, but I believe it would also be considered to be better by many Haskell programmers.

    Read on →

  • Why doesn't software project management handle risk better?

    I work in software. A perennial bugbear of software project management is: why do so many software projects go over time? Moreover, why do they do this when so much time is spent trying to break down projects and get engineers to estimate how long the pieces will take?

    The answer is simple: things take longer than we expect. And we know that we’re uncertain about our estimates when we make them, i.e. there’s actually some probability distribution over the time the task will take. So why are we surprised that things blow out and why don’t we have the tools to measure and deal with this?

    Read on →