Course Introduction: Safer JavaScript with the Maybe type

Andy Van Slaars
InstructorAndy Van Slaars

Share this video with your friends

Send Tweet

JavaScript's dynamic typing makes the language incredibly flexible. That flexibility comes at a cost. Because any variable can potentially be of any type, it's easy to inadvertently introduce runtime Type errors into an application.

The Maybe data type encapsulates the defensive coding needed to avoid such errors, keeping our application code focused on the task at hand.

In this course, we'll look at the Maybe type in action. We'll be relying on the Maybe exposed by the crocks library, but the core concepts and much of the API translates to other implementations. We'll learn how to construct a Maybe and apply transformations to data within those safe confines. We'll also cover point-free utility functions that let us build up function compositions for working with Maybes

After completing this course, you'll have the tools to write safe, declarative JavaScript that can be easily composed while avoiding the unnecessary noise of sprinkling imperative conditional statements throughout your code.

Christian
Christian
~ 3 years ago
Benjamin
Benjamin
~ 3 years ago

Hope you don't mind a slightly meta question, are you able to let us know the font you're using, and the extension which is providing the live preview for variables and errors?

Guy
Guy
~ 3 years ago

Hey Benjamin, can't speak for the font, but the extension being used is called quokka.js. FWIW, I think it is a fantastic JS scratchpad, can't recommend it enough. https://quokkajs.com/

Andy Van Slaars
Andy Van Slaarsinstructor
~ 3 years ago

Hope you don't mind a slightly meta question, are you able to let us know the font you're using, and the extension which is providing the live preview for variables and errors?

The font is operator mono, and Guy is right. The live preview is coming from Quokka.

Benjamin
Benjamin
~ 3 years ago

Thanks for the answers! Going to have to try these both out myself.

Aaron
Aaron
~ 3 years ago

What's the plugin you're using for vscode to eval your JS inline with the editor?

Andy Van Slaars
Andy Van Slaarsinstructor
~ 3 years ago

That plugin is called Quokka - https://quokkajs.com/

Nathan Cox
Nathan Cox
~ 3 years ago

@Benjamin there's a really good Operator Mono alternative called Dank (https://dank.sh) which is quite a bit more affordable.

Andy Van Slaars
Andy Van Slaarsinstructor
~ 3 years ago

Dank Mono is fantastic, recently switched to it myself.

Maxime Beaudoin
Maxime Beaudoin
~ 3 years ago

Do you think its possible and clean to use the library with TypeScript ?

Andy Van Slaars
Andy Van Slaarsinstructor
~ 3 years ago

Do you think its possible and clean to use the library with TypeScript ?

Since TS is a superset of JS, it’s possible. I don’t know if crocks has typings defined, so you might not get the type support you’d get out of the box with other libraries.

A. Lion
A. Lion
~ 3 years ago

Hi Andy, First off, thanks for your videos; really enjoyable explanations on Functional Programming topics. Second - to allow the continuation of the meta questions: Which VS color scheme are you using here? (Yes, we want to be exactly like you ;))

Andy Van Slaars
Andy Van Slaarsinstructor
~ 3 years ago

I’m glad you’re enjoying the videos :)

The theme used in this video is the one found here:

https://github.com/orefalo/bcmarinacci.theme-material-operator-1.3.0