A implmentation inspired by http://codon.com/refactoring-ruby-with-monads?utm_source=rubyweekly&utm_medium=email