Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Functional Programming in Go

You're reading from   Learning Functional Programming in Go Change the way you approach your applications using functional programming in Go

Arrow left icon
Product type Paperback
Published in Nov 2017
Publisher Packt
ISBN-13 9781787281394
Length 670 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Lex Sheehan Lex Sheehan
Author Profile Icon Lex Sheehan
Lex Sheehan
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Pure Functional Programming in Go 2. Manipulating Collections FREE CHAPTER 3. Using High-Order Functions 4. SOLID Design in Go 5. Adding Functionality with Decoration 6. Applying FP at the Architectural Level 7. Functional Parameters 8. Increasing Performance Using Pipelining 9. Functors, Monoids, and Generics 10. Monads, Type Classes, and Generics 11. Category Theory That Applies 12. Miscellaneous Information and How-Tos

Preface

Until recently, the message has been Go and functional programming—don't do it.

Functional programming (FP) is a perfect fit for multicore, parallel processing. Go is a concurrency baller (with Goroutines, channels, and so on) and already runs on every available CPU core. FP reduces complexity; simplicity is one of Go's biggest strengths. 

So, what can FP bring to Go that will actually improve our software applications? Here's what it offers:

  • Composition: FP shows us how to decompose our apps and rebuild them by reusing small building blocks.
  • Monads: Using monads, we are able to safely order our workflows into pipelines of data transformations.
  • Error handling: We can leverage monadic error handling and still maintain compatibility with idiomatic Go code.
  • Performance: Referential transparency is where we can evaluate our function once and then subsequently refer to its pre-computed value.
  • Expressive code: FP allows us to concisely express business intent in our code. We declare what our functions do, without the clutter of error checking after every function call, and without having to follow state changes (pure FP means immutable variables).
  • Simpler code: No shared data means not having to deal with semaphores, locks, race conditions, or deadlocks.

Most people have difficulty grasping FP.

I did too. And when I got it, I wrote this book. Take this journey with me. We'll see hundreds of illustrations, read easy-to-understand explanations, and implement FP in Go code along the way.

I enjoyed coaching soccer. The litmus test I used to determine whether I succeeded as a coach was the answer to this simple question: Did they all register for next season and request me to be their coach? Just like planning practice, I planned each chapter, starting with simple concepts and adding to them. Read this book, then you too will be able to say, I got it.

If you want to improve your FP skills, this book is for you.

lock icon The rest of the chapter is locked
Next Section arrow right
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime