Functional Programming with Go
summary
Argues that Go can use functional ideas — closures, currying via closures, tail recursion and pure functions — to get safer, more testable code while noting tradeoffs: no generics (workaround via code generation), no tail-call optimization, and extra hidden loops hurting hot paths. Demonstrates libraries like gleam, pi and hasgo, shows a concrete hasgo-generated pipeline (inRange → abs → filter(isEven) → sum) that returns sum equals 60, and a real example generating movies pipelines (filter, nub, take, map) with options-style constructors that work but may not be idiomatic or fastest.
AI-written summary · about
chapters (25)
- 0:00Intro
- 0:54When people think of FP...
- 2:06Misconceptions?
- 4:12Why FP?
- 6:23A gentle introduction
- 7:18Say what, not how
- 8:31Immutable functions
- 10:48Pure function vs side-effect
- 13:05Idempotence
- 15:08First-class / higher-order functions
- 17:03Recursion vs Tail Recursion
- 20:00Up Next... Closures
- 21:30Currying Function with 1 parameter, returning Closure
- 25:06Practical use-case: Reduce function params
- 26:00Server Options Example
- 26:42Defining Options
- 27:43Constructor
- 29:03Default Options
- 29:59Declarative Programming?
- 32:02Hasgo
- 34:19Generating functions
- 35:22Generated Code
- 36:50Code Generation Example
- 40:23Add your own!
- 42:11Some drawbacks..
related talks
01h 04mAn Introduction to Functional Programming in Go
21mFunctional Go?
44mFunctional Programming You Already Know
51mI'll Teach You Functionalism in Go!
51mI'll teach you functionalism in Go!
41mFunctional programming: Give it a chance!
58mFunctional Programming with C#
41mFunctional Programming for Dummies*
