Implementing Wadler's "The essence of functional programming"