Functional programming patterns for the non-mathematician (cut)
Why Stack Overflow recommends it
Stack Overflow users link it as a practical, JavaScript-based introduction to functors and monads when answering or asking about functional programming concepts like lenses, fmap and flatMap.
Recommended by 1 people across 1 different months, 2014 to 2016.
What it is
A 30-minute conference talk by Brian Lonsdorf (DrBoolean) that walks through practical uses of functors, applicatives and monads in JavaScript, aimed at developers without a math background. It moves quickly and links to code on GitHub so viewers can experiment.
What people said
Recommends Safareli · 2016-12 · Stack Overflow · on “Cleaner/shorter way to update nested state in Redux?”
You can use Lenses. import { set, makeLenses } from '@DrBoolean/lenses' const L = makeLenses(['notificationBar', 'open']); const notificationBarOpen = compose(L.notificationBar, L.open) const setNotificationBarOpenTrue = set(notificationBarOpen, true) const a = { notificationBar: { open: false } } const b = setNotificationBarOpenTrue(a) // `a` is left unchanged and `b` is `{ notificationBar: { open: true } }` You can think about Lenses as compositional property access/update. Some good resources about Lenses: video Lenses Quick n' Dirty [LINK] practical article Lenses and Virtual DOM Support Open Closed [LINK] video Functional programming patterns for the non-mathematician [this video] article ab
Cites Cristian Garcia · 2014-05 · Stack Overflow · on “Current State of JavaScript Functional Programming Libraries”
The Libraries Low Dash [LINK] Underscore inspired, fixes lots of stuff apparently, great API Apparently it was so inspired by underscore that its also doing it wrong! [LINK] fn.js [LINK] Currently under 1.0 but great documentation, basic functions Bilby.js [LINK] Created by Brian Mckenna, a guy who is/was developing a functional language that compiled into JavaScript. Seems to have a core functional programming concepts. Edit: Bilby seems to be compliant with the Fantasy Land specification. Fantasy Land [LINK] Fantasy land not only includes tons of functional programming modules, it also includes a formal specification on how to implement "algebraic structures" (aka your objects) to be compa
Cites Dustin Stiles · 2016-03 · Stack Overflow · on “Difference between 'fmap' and 'flatMap', if any”
Every resource I've found so far compares map and flatMap . That is not my intention. In this YouTube video about functional programming in javascript (particularly around 12:27), the speaker shows an example of fmap ing over a Maybe functor. All is well and good so far. What confuses me is the mjoin , and the speaker's comment about how flatMap (not fmap ) is simply a composition of fmap and mjoin . This confuses me because up until now I have used the names fmap and flatMap interchangeably, although this talk implies they are not the same thing. For a concrete question, I would like to know if this is implementation specific, or are fmap and flatMap actually two different things, in the co