Functional Programming for the Web – November 2016

The November Functional meetup brought much merriment to the freezing streets of London. Hot pizza, cold beer, clever likeminded people, and of course the main event: the talks.

Joe Paice - The Language of Functional

It is no secret that the Badgers are great fans functional programming and Joe is no exception. Having had a dive into the depths of functional himself, he gave us a gentle introduction some of the basic building blocks.

Monoids - a monoid is basically a a combination of two things: a set of some sorts, e.g. the set of natural numbers (0, 1, 2, 3, ...) and some binary operation (e.g. addition) IF it satisties two conditions:

  1. Associativity. Given any two of the elements in the set, it doesn't matter which order you do the operation in, e.g. (2 + 3) is the same as (3 + 2)
  2. Identity. That is, an element that when you apply this operation with any other element in this set, you always get the same element back, e.g. for the addition of natural number, that would be the number zero, as 2 + 0 is the same as 2

It might be helpful to note that the natural numbers with the binary operation division is NOT a Monoid, because the first rule fails: 3/6 = 0.5, but 6/3 = 2.

Continuing on the same path, Joe spoke about Composition, Functors, List, Maybes, Foldables and Monads. A great intro to explain some of the "scary-sounding" functional concepts. Never fear. They're like spiders - more afraid of you than you are of them.

If Joe's talk got you in a functional mood, check out some of his suggested reading:

LambdaCat - The Midnight Mondad

Adit - Functors, Applicatives and Monads in Pictures

Brian Beckman: Don't fear the Monad

Learn you a Haskell

Fantasy Land

Stuart Harris - A Safer Future

We all know about Promises. We use them daily. But who's heard of Futures? Futures are conceptually very similar to Promises but some very significant pros.

This idea of Futures vs Promises lead to the inception of Fantasy Land - an algebraic specification for JavaScript. A "what the language COULD be". It's been increasingly popular with the functional community and many parts of the spec have already been implemented.

Stu did a demo of how he used Fluture - FantasyLand compliant (monadic) alternative to Promises - to build a simple app with async data loading. It's a rare and wonderful thing to see clean and actually functional JavaScript in action. Unless you're a Badger :) PS! We're hiring!

Thank you to our amazing speakers this month. If you'd like to speak at the next functional meetup, get in touch!

Kadi Kraman

Software Engineer

More from Kadi