Created
June 14, 2019 16:18
-
-
Save enricopolanski/1e20b9dcdca85a3fd03b0e6d327e3dcc to your computer and use it in GitHub Desktop.
Functional JS/TS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A Functor is "something" we can map: to be specific it is a mapping between categories that preserves the categorical structure, i.e. that preserve identity morphisms and composition. | |
// Since categories are constituted of two things (objects and morphisms) a functor is constituted of two things as well: | |
// - a mapping between objects that associates to each object x in C an object in D | |
// - a mapping between morphisms that associates to each morphism in C a morphism in D | |
Array, Tree, Stream, Promise are all functors, we can map all of them. | |
// A Monad is a functor that we can flatMap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment