Functional programming in Go with generics

submited by
Style Pass
2021-05-27 02:00:03

Functional programming is an increasing popular programming paradigm with many languages building or already supporting it. Go already supports some of these features such as first-class and higher order functions and enabling functional programming.

One key feature that’s been missing from Go is generics. Without this feature, functional Go libraries and applications are forced down one of two paths: type safe + use-case specific or type-unsafe + use-case agnostic. With the upcoming release of Go 1.18 in early 2022, generics are expected to be added to the language which will enable new sorts of functional programming solutions in Go.

In this article, I’ll cover some background on functional programming, survey functional programming landscape today in Go, and discuss features planned for Go 1.18 and how they could enable functional programming.

For more detailed information on Functional Programming, have a look at these two great articles that describe it at length with examples: What is Functional Programming? and Functional Go

Leave a Comment