Course Introduction: Safer JavaScript with the Maybe type

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
~ 6 years ago
Benjamin
~ 6 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
~ 6 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 Slaarsinstructor
~ 6 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
~ 6 years ago

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

Aaron
~ 6 years ago

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

Andy Van Slaarsinstructor
~ 6 years ago

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

Nathan Cox
~ 6 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 Slaarsinstructor
~ 6 years ago

Dank Mono is fantastic, recently switched to it myself.

Maxime Beaudoin
~ 6 years ago

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

Andy Van Slaarsinstructor
~ 6 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
~ 6 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 Slaarsinstructor
~ 6 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