Skip to content
0:00 / 0:00

#crocks#algebraicdatatypes#applicativefunctors

Functional JS - Working with ADTs - 01

TheEvilSoft

1K subscribers • 1 video on Hallway

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • A classic. People kept recommending it from 2017 to 2022.
  • May be out of date. Uploaded 9 years ago, in an area where tools change fast.

Intermediate. Assumes working knowledge.

4.1K views9 years ago2 recommendations

Programming languagesWeb developmentJavaScriptFunctional programming

A live coding session implementing a card guessing game in JavaScript using algebraic data types and the crocks library.

This is the first in a multi-part series of Live Coding Session where we implement a simple Card Guessing (ESP style) Game using Algebraic Datatypes in good ol' Javascript. In this session we will start building a deck of Playing Cards and get them all shuffled. Along the way we will get to play with things like `Applicative Functors`, `Semigroups` and `Product` types (`Pair`). The finished code is provided as a branch on a github repo. * The branch can be found here: bit.ly/adts-01-github * The main repo can be found here: bit.ly/adts-github The ADT library used can be found here: bit.ly/crocks-github

Why it's here

2 people recommend this

What people say. Recommended as a practical series for learning algebraic data types in JavaScript.

u/ImaginaryKarmaPointsin r/functionalprogramming • Recommends

On “Fp library for JS”

…IMO the bigger gains from FP come from restructuring code to make most operations into processing pipelines, and this is where the Algebraic Data Types come in handy - it took me quite a while to wrap my head around them however. For conceptual overview, Scott Wlaschin has some good videos (he uses F# instead of JS but concepts are the same) e.g. link to this video For Javascript examples, look up Brian Lonsdorf on Youtube. To really grok ADTs I found it helpful to follow along with the Crocks live coding videos, pausing to try out things on my own machine - link to this video…

u/robertwpearcein r/functionalprogramming • Recommends

On “What are your go to functional JavaScript libraries?”

I've echoed van Slaars on twitter before, but I work with the author of crocks, and it's the real deal. The author of crocks has a series on ADTs (using crocks) on YouTube: link to this video edit: past tense edit2: youtube link