Inspired by https://fsharpforfunandprofit.com/posts/monadster/.