Tom has gracefully permitted us to copy his work from the monads gem into Active Support as needed. The API I'm most keen to see is the one that allows us to use the Many monad with Active Record relations, like so:
It's a huge level up over the flat_map version:
I've wanted this for a very long time, but could think of the right way to express it. The monad is the way!
So to make this work, I'd propose that we pull in the Maybe monad into Active Support, then do a core extension for Enumerable called #with_many, and then making sure that plays nicely with the AR relations (I think it should, out of the box).