mo - Monads is a functional programming utility library for Go that introduces monads and related abstractions using modern Go generics. The project brings well-known FP constructs such as Option, Result, Either, Future, IO, and Task into the Go ecosystem to help developers write safer and more composable code. By leveraging generics introduced in Go 1.18+, the library provides strong type safety without relying on reflection or code generation. It is particularly useful for managing nullable values, error propagation, asynchronous workflows, and functional pipelines in a predictable way. The design draws inspiration from languages like Scala, Rust, and TypeScript FP libraries, making it familiar to developers with functional backgrounds. Overall, samber/mo enables a more declarative and expressive programming style in Go while remaining lightweight and dependency-free.
Features
- Option Result and Either monads
- Future and Task abstractions
- IO and State functional utilities
- Type-safe generics-based API
- Functional composition helpers
- No external dependencies