IBM/fp-go

Description: Functional programming library for Go 1.24+, inspired by fp-ts. Uses generic type aliases for a clean, composable API. Provides Option, Either, Result, IO,...

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 5 minutes ago
Added to GitGenius on March 8th, 2026
Created on July 5th, 2023
Open Issues & Pull Requests: 7 (+0)
Number of forks: 80
Total Stargazers: 2,014 (+0)
Total Subscribers: 16 (+0)

Issue Activity (beta)

Open issues: 2
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 850 days
Stale 30+ days: 1
Stale 90+ days: 1

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

No label distribution available yet.

Most active issues this week

No issue events were indexed in the last 7 days.

Repository Insights (GitGenius)

Median issue/PR response: 5.2 days
Mean response time: 42.5 days
90th percentile: 140.3 days
Tracked items: 4

Most active contributors

Detailed Description

fp-go is a functional programming library for Go 1.24+ developed by IBM that brings functional programming patterns to Go through generic type aliases and composable APIs. The library is heavily inspired by fp-ts, a popular TypeScript functional programming library, and aims to make it easier to write maintainable and testable code by encouraging pure functions, side effect isolation, and consistent composition patterns across data types.

The core of fp-go provides several key monadic data types that enable functional composition. These include Option for representing optional values, Either for handling computations that can fail with an error or succeed with a value, IO for lazy computations, IOEither for lazy computations that can fail, Reader for computations dependent on an environment, ReaderIOEither for combining reader, IO, and Either capabilities, Task for asynchronous computations, and State for stateful computations. All these data types support common monadic operations like Map for transforming values, Chain for flatMapping, Ap for applying functions in context, Of for wrapping values, and Fold for extracting values.

The library explicitly aligns itself with the Zen of Go principles, demonstrating how functional programming patterns can coexist with Go's philosophy. Each top-level package fulfills a single purpose by defining one data type and its operations. The library handles errors explicitly through the Either type, encourages returning early rather than nesting deeply through small focused functions, and avoids package-level state entirely. It also provides optics including Lens, Prism, and Traversal for immutable data manipulation, supporting Functor, Applicative, and Monad abstractions with do-notation-style programming.

The implementation leverages Go's generics system for type safety, though this comes with the tradeoff of potentially larger binaries due to different versions per type. The library addresses Go's lack of native higher-kinded types by introducing HKTs as individual types and implementing generic algorithms in internal packages to keep complexity hidden from end-users. Generic subpackages are available for library extensions, while main packages specialize generic implementations for convenience.

According to GitGenius activity tracking, the repository shows median issue and pull request response latency of 123.7 hours with a mean of 1019.8 hours across tracked items. The most active contributors include CarstenLeue with 6 tracked events and Ocramius with 3 events. The repository overlaps with contributors from other projects including ocramius/proxymanager, meteor/meteor, and apollographql/apollo-client, indicating cross-pollination with other functional programming and web development communities.

The library provides conversion utilities to bridge between idiomatic Go and functional styles, including Eitherizerize functions for converting idiomatic Go functions to functional style and Uneitherizerize functions for the reverse conversion. This makes it practical for integrating functional patterns into existing Go codebases. The repository includes code samples and comprehensive API documentation, with version 2 specifically requiring Go 1.24 and leveraging the latest generic capabilities available in that release.

fp-go
by
IBMIBM/fp-go

Repository Details

Fetching additional details & charts...