3 ms·
Luckily, the nice thing about functional "design patterns" as invented by the haskell community always have mathematical laws attached to them. The advantage o
by bollu 6y ago
Luckily, the nice thing about functional "design patterns" as invented by the haskell community always have mathematical laws attached to them.
The advantage of having formal laws is that functional programmers can reason mathematically about their design patterns.
This is completely different from the OOP case, where a "design pattern" is something someone found useful X number of times, with no rhyme or reason for structuring things this way. Which is why, in my opinion, it's so hard to talk about OOP design patterns beyond "it seems to fit".
This is completely unlike the OOP community, where a design pattern has a poor spec written in english.
- siraben 6y agoHaving learned FP's design patterns before OOP's, it was amusing to ask questions such as, "what are the laws for visitors/iterators/builders?" In the FP community, the laws for folds/unfolds/functors etc. are sacred, which make for very robust programs and well-behaved libraries.
- Sharlin 6y agoIt’s the difference between the engineer’s approach and a mathematician’s one. (Physicists, they just write FORTRAN.) To be fair, design patterns were quite explicitly introduced as ”these are things OO people seem to reinvent and converge on, so seemed worth documenting.”