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

This book is 95% complete

Last updated on 2020-06-09

About the Book

Note: This is not an Introductory book in Javascript or TypeScript. The reader must have at least a couple of years of Javascript or TypeScript experience. Please read the Sample pdf to get an idea about the content of the book,also browse some of the codesandbox here [ https://codesandbox.io/u/dimitris-papadimitriou-chr/sandboxes]

A Paperback version is now Available in Amazon - Functional Programming in TypeScript

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 an online autonomous fiddle TypeScript code [ https://codesandbox.io/u/dimitris-papadimitriou-chr/sandboxes], 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 TypeScript or 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 fp-ts, purify, 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.

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

https://www.fluidinfunctional.com/

https://www.linkedin.com/in/dimitrispapadimitriou/

Bundles that include this book

Functional Programming in Javascript
 Functional Programming in TypeScript
$20.00
Suggested Price
$15.00
Bundle Price
Functional Programming in Javascript
 Functional Programming in TypeScript
Asynchronous functional javascript
$24.99
Suggested Price
$17.99
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
  • 6 Monads
    • 6.1 Maybe Monad ... 105
    • 6.2 Either Monad ... 108
    • 6.2.1 Natural Transformation Between Maybe and Either ... 109
    • 6.2.2 Using Either Monad exception handling ... 110
    • 6.3 Promise as a Monad ... 112
    • Dissecting the Promise.then method 112 ...
    • 6.3.1 The then as a monadic Bind ... 113
    • 6.4 Combining Promises and Either ... 118
    • 6.5 Combining Promises and Either - Example ... 119

Authors have earned$9,108,966writing, 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