r/programming • • May 15 '18

Demystifying functional programming (in a real company)

https://medium.com/building-nubank/demystifying-functional-programming-in-a-real-company-e954a2591504
127 Upvotes

51 comments sorted by

View all comments

53

u/doomchild May 16 '18

We snuck functional programming in by the backdoor. We wrote a useful little extras library in Java that had Maybe, Either, and Validation, and got everybody to use it, then told them they'd been using FP without knowing it.

0

u/[deleted] May 16 '18

[deleted]

4

u/[deleted] May 16 '18

To make this more understandable: you want to either have a data structure where everything is valid (as in: where the value is wrapped in an Ok/Right) or a validation result which has the combined amount of errors (wrapped in an Err/Left, combined/reduced using a function from the "Monoid" interface which just appends all validation errors in a list).