---
title: "Discussion on \"Library vs Language: Two Approaches to Functional Programming in Go\" | Hashnode"
description: "Discussion on \"Library vs Language: Two Approaches to Functional Programming in Go\". If you have used IBM's fp-go library, you know the promise of functional programming in Go -- and the pain of Go's syntax fighting you every step of the way. Pipe3, Pipe5, Pipe7. Function adapters eve"
url: "https://hashnode.com/posts/library-vs-language-two-approaches-to-functional-programming-in-go/69b72918f4eb2f8b04f88862"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Library vs Language: Two Approaches to Functional Programming in Go](https://martianov.dev/library-vs-language-two-approaches-to-functional-programming-in-go?utm_source=hashnode&utm_medium=feed)

If you have used IBM's fp-go library, you know the promise of functional programming in Go -- and the pain of Go's syntax fighting you every step of the way. Pipe3, Pipe5, Pipe7. Function adapters eve

Mar 15 · 12 min read · martianov.dev  
Updated Mar 19  
Read the article

-   [#go](https://hashnode.com/tag/go)
-   [#functional-programming](https://hashnode.com/tag/functional-programming)
-   [#programming-languages](https://hashnode.com/tag/programming-languages)
-   [#programming-tips](https://hashnode.com/tag/programming-tips)
-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)

## Written by

[Maksim Martianov](https://hashnode.com/@martianov)

@martianov · Seattle, WA

  
[View profile](https://hashnode.com/@martianov)

SWE at Snowflake. Ex-SWE Twitter/X, Route4me

Staff Software Engineer at Snowflake. Expert in scalable architecture, cloud infra, and security. Passionate problem-solver and mentor.

## Responses 4

Markdown supported · ⌘↵ to post

[carsten-leue](https://hashnode.com/@carsten-leue)

[May 28](https://hashnode.com/posts/library-vs-language-two-approaches-to-functional-programming-in-go/69b72918f4eb2f8b04f88862/comment/6a18b59b78258754833c69aa)

Congratulations on this awesome article and kudos for the development of GALA. I think you are spot on pinpointing the challenges one faces when trying to apply functional patterns to pure go. In particular the lack of function overloading that leads to PipeXXX in fp-go is a real pain point. And so is the limitted types system. Go 1.24 has made a significant step forward by allowing type aliases for generic types. This makes switching between monads much simpler.

As the author of fp-go I would like to point out that the syntax of the fp-go examples can be simplified.

For example instead of

```go
result := function.Pipe3(
    O.Some(42),
    O.Map(func(x int) int { return x * 2 }),
    O.Chain(func(x int) O.Option[int] {
        if x > 50 { return O.Some(x) }
        return O.None[int]()
    }),
    O.GetOrElse(func() int { return 0 }),
)
```

I would write

```go
    result := F.Pipe3(
        O.Some(42),
        O.Map(N.Mul(2)),
        O.Filter(N.MoreThan(50)),
        O.GetOrElse(L.Of(0)),
    )
```

Actually in the spirit of the library I would avoid writing a pipeline but rather a new function that implements the pipeline and that can then be reused and composed like this:

```go
    endo := F.Flow4(
        O.Some,
        O.Map(N.Mul(2)),
        O.Filter(N.MoreThan(50)),
        O.GetOrElse(L.Of(0)),
    )
    fmt.Println(endo(42))
    fmt.Println(endo(2))
```

As a bonus such a function can be unit tested.

Thanks for your splendid work and for spreading the idea of functional patterns across the go community!

Carsten

[Maksim Martianov](https://hashnode.com/@martianov)

[May 29](https://hashnode.com/posts/library-vs-language-two-approaches-to-functional-programming-in-go/69b72918f4eb2f8b04f88862/comment/6a18b59b78258754833c69aa#reply-6a190c6978258754835e6e3a)

Nice to meet you, Carsten, and thank you for the great library! Indeed, your examples are easier. I wish Go were just more FP-friendly by default. Since this article, I have made significant improvements in semantics, performance, and reliability and already at release 0.50.0. Besides semantics, GALA provides immutability by default, better generics, pattern matching, named parameters and much more.

[Sunil Kumar](https://hashnode.com/@ailoitte)

[Mar 16](https://hashnode.com/posts/library-vs-language-two-approaches-to-functional-programming-in-go/69b72918f4eb2f8b04f88862/comment/69b79bd1f4eb2f8b04563717)

Great article - really enjoyed reading this.

The comparison between the library approach (fp-go) and the language-level approach (GALA) to bringing functional programming into Go is very insightful. The examples around Option pipelines, Either error handling, and collection transformations clearly show how Go’s syntax introduces verbosity when FP patterns are implemented purely as libraries.

I especially liked the discussion around type annotations, Pipe functions, and the signal-to-noise ratio in fp-go versus the cleaner method chaining, lambda inference, and pattern matching in GALA. The side-by-side examples make the trade-offs very clear.

It’s interesting to see how fp-go proves that FP abstractions can work in Go, while GALA explores what happens when those ideas are supported at the language level instead of through libraries.

Really thoughtful breakdown of the design tension between staying within Go’s ecosystem vs improving developer ergonomics for FP-heavy codebases.

[Maksim Martianov](https://hashnode.com/@martianov)

[May 29](https://hashnode.com/posts/library-vs-language-two-approaches-to-functional-programming-in-go/69b72918f4eb2f8b04f88862/comment/69b79bd1f4eb2f8b04563717#reply-6a1909d378258754835d706e)

Thank you!
