Implement a Scala version of OptionalBinder.