Functional Programming in Javascript
Functional Programming in Javascript
$10.00
Minimum price
$10.00
Suggested price
Functional Programming in Javascript

This book is 95% complete

Last updated on 2020-01-23

About the Book

Note: This is not an Introductory book in Javascript. The reader must have at least a couple of years of Javascript experience. Please read the Sample pdf to get an idea about the content of the book, also browse some of the JsFiddles here [https://jsfiddle.net/user/functionalCategories/fiddles/]

One of the main reasons for this book is to transfer in the community of object-oriented developers some of the ideas and advancements happening to the functional community side and the mathematical foundations behind them.

Extra: With this book, you get as an extra the TypeScript Translation of this book [Funcitonal Programming in TypeScript] in a pdf format

Book Description

This book goes beyond the introductory ideas of functional programming, while progressively building on practical examples in a comprehensive manner. Each example is accompanied by online autonomous js fiddle javascript code [https://jsfiddle.net/user/functionalCategories/fiddles/], which you can run fork and modify, in order to deepen your understanding of each section.

By the end of this book, you will have a deep understanding of the ideas behind functional JavaScript that will allow you to program in a functional style with confidence. Also, you will have an overview of how famous functional libraries like Ramda, Folktale, Sanctuary, etc. have implemented the different functional concepts.

What you will learn:

  1. Go beyond the Array.map by understanding how to generalize the idea of map to Functors like Maybe, Either and Promises, etc.
  2. Go beyond the idea of Array.reduce by understanding the concepts of fold and catamorphism over data structures.
  3. Learn how to combine functional ideas in order to solve practical problems.
  4. Use Monads like Maybe, Either, IO, Continuations, and Promises to chain computations.
  5. Get a deep understanding of recursive methods and learn how to define recursive methods on algebraic data structures.
  • Share this book

  • Feedback

    You must own a copy of this Book to access the forums

    Email the Author(s)

About the Author

dimitris papadimitriou
dimitris papadimitriou

I have more than 12 years’ experience as full stack developer and Architect.

I Like to stay in touch with all the latest developments in the field, as well as the foundational Theoretical Computer science and algorithm Analysis and Design

Packages

The Book

Includes:

  • extras
    Functional Programming in TypeScript

    This is the TypeScript translation of the Book up to the Monads Chapter. The strong typing of the TypeScript might be helpful in understanding some of the simplifications

  • English

  • PDF

$10.00
Minimum price
$10.00
Suggested price
Book and Video Lectures

Those are the video lectures covering the Chapters of Functors and Monads of this book

Includes:

  • extras
    Functional Programming in TypeScript

    This is the TypeScript translation of the Book up to the Monads Chapter. The strong typing of the TypeScript might be helpful in understanding some of the simplifications

  • extras
    video lectures

    Those are the video lectures covering the Chapters of Functors and Monads of this book

  • English

  • PDF

$15.00
Minimum price
$15.00
Suggested price

Bundles that include this book

Functional Programming in Javascript
 Functional Programming in C#
$20.00
Suggested Price
$15.00
Bundle Price

Table of Contents

  • 1.1 Categories 10
    • 1.2 Essential Lambda calculus with Js 12
    • 1.3 SKI combinators 13
    • 1.4 Minimum Type theory 15
    • 1.5 String Diagrams 15
  • 2 The Pillars 18
    • 2.1 Monoids 18
    • 2.1.1 Function composition as a monoid 21
    • 2.1.2 Composing monoids 25
    • 2.1.3 Folding monoids 23
    • 2.2 folding functions under composition 25
    • 2.2.1 Monoid homomorphisms and Parallelism 27
    • 2.3 Higher order functions 30
    • 2.3.1 Strategy pattern 30
    • 2.4 Currying and partial application 32
  • 3 Algebraic Data Types 37
    • 3.1 The product structure: 37
    • 3.1.1 Introduction / Elimination 39
    • 3.2 The co-product structure: 40
    • 3.2.1 Introduction / Elimination 42
    • 3.3 One 43
    • 3.4 Recursive Algebraic Types 44
    • 3.4.1 On the value of the symbolic representation 45
    • 3.5 Extending Union Types 47
    • 3.5.1 Adding pattern matching 47
  • 4 Functors 49
    • 4.1 The Identity Functor 49
    • 4.2 Commutative Diagrams 50
    • 4.3 The Functor Laws 51
    • 4.4 Extending Promise as Functor 53
    • 4.4.1 The Promise - functor laws 53
    • 4.5 IO Functor, a Lazy Id Functor 54
    • 4.5.1 Thunks 54
    • 4.5.2 IO Functor 55
    • 4.6 Reader Functor 56
    • 4.7 Maybe Functor 58
    • 4.7.0 Dealing with null - Null object Design pattern 58
    • 4.7.1 The Null Object Design pattern 58
    • 4.7.2 The Functional equivalent - Maybe as Functor 59
    • 4.8 Either Functor 60
    • 4.9 Either for exception handling 61
    • 4.1 functors from Algebraic Data types 64
    • 4.11 Functor Composition 66
    • 4.12 Applicative Functor 68
    • 4.13 Reader Applicative Functor 69
    • 4.14 Composing Applicatives 71
    • 4.15 Decorator design pattern functional idiom with functor 72
  • 5 An Introduction to Catamorphisms 74
    • 5.1 Catamorphisms 74
    • 5.1.1 Union types cata 75
    • 5.1.2 Recursive types cata 76
    • 5.2 Catamorphisms through the Visitor Design pattern 77
    • 5.2.1 Extending Union Types: Using cata 78
    • 5.3 Folds 78
  • 6 Traversable 79
    • 6.1 Traversable Array with Either applicative for validation 81
    • 6.2 Traversable Algebraic data structures 82
    • 6.3 Identity Traversable 83
    • 6.4 Applicative Reader Isomorphism with the Interpreter Design pattern 83
    • 6.5 Composing Traversables 86
    • 6.6 Foldable 86
    • 6.6.1 FoldMap 88
    • 6.6.2 filter 88
    • 6.6.3 Mixins 88
    • 6.6.4 Composing Foldables 89
    • 6.6.5 Iterators 90
  • 7 Yoneda Lemma 92
    • 7.1 Co-Yoneda Lemma 93
  • 8 Natural Transformations 95
    • 8.1.1 Natural Transformation Between Maybe and Either 97
  • 9 Monads 99
    • 9 Monads 99
    • 9.1 Introduction 99
    • 9.2 The List Monad 101
    • 9.3 The Identity Monad 101
    • 9.3.1 Monad laws for Identity Monad 102
    • 9.4 Monads -Kleisli Composition in Javascript 103
    • 9.5 Monad laws following Kleisli formulation 104
    • 9.6 Maybe Monad 105
    • 9.7 Either Monad 108
    • 9.7.1 Using Either Monad exception handling 108
    • 9.7.2 Validation type 110
    • 9.8 State Monad 110
    • 9.8.1 Traversing with State 113
    • 9.9 Reader Monad 115
    • 9.1 IO monad 117
    • 9.11 Writer Monad 118
    • 9.11.1 Traversing with Writer 119
    • 9.12 Deriving the Continuation Monad 119
    • 9.13 The continuation monad 123
    • 9.14 Extending Promises to Monads 123
    • 9.14.1 Async Error handling with either 125
    • 9.14.2 Implementing Bind 126
  • 10 Comonads 128
    • 10.1 The Identity Comonad 128
    • 10.2 Co-Monad laws for Identity Co-Monad 129
    • 10.3 CoKleisli Composition 130
    • 10.3.1 Co-Monad laws following Co-Kleisli formulation 131
    • 10.4 Store Comonad 131
    • 10.5 Lazy comonad ? 132
    • 10.6 Pair Comonad 133
    • 10.7 Tree Comonad 136
    • 10.8 Spatial Comonad 137
    • 10.9 Stream Comonad 140
    • 10.1 Tree annotation 141
  • 11 F-Algebras 144
    • 11.1 F-Algebras Homomorhisms 148
    • 11.2 Initial Algebras 150
    • 12 F -Coalgebra 150
    • 12.1 Catmorphisms 151

Authors have earned$8,704,777writing, publishing and selling on Leanpub,
earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub