Skip to content

Instantly share code, notes, and snippets.

@danny-andrews
Created October 23, 2017 11:09
Show Gist options
  • Save danny-andrews/e3fafff66493a9bd4dbd30ae95797a3e to your computer and use it in GitHub Desktop.
Save danny-andrews/e3fafff66493a9bd4dbd30ae95797a3e to your computer and use it in GitHub Desktop.
my-articleforimport

Level 1 (Loops) - (map, reduce, filter, more).

Level 2 (Callbacks/Async) - Use Promises (or better yet, Futures).*.

Level 3 (Assignment) - pipe or compose functions together to avoid unnecessary intermediate variable declarations.

A wild monad appears! Monet Olé!

Level 4 (null/undefined) - Use Maybe monad.*.

Level 5 (throw) - Just return Errors instead. The function in this case will have a union/variant return type e.g. Int | Error. Alternatively, use the Task monad.

Level 6 (Branches) - Use Either monad*

Purity enters the stage

Level 7 (Side-effects) - Use I/O Monad*

Continue using other OO patterns!

🚨🚨🚨Use this!🚨🚨🚨: https://mat3e.github.io/brains/# and thank creator

Inspired by: https://www.youtube.com/watch?v=SfWR3dKnFIo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment