back to home

samber / mo

🦄 Monads and popular FP abstractions, powered by Go 1.18+ Generics (Option, Result, Either...)

View on GitHub
3,306 stars
109 forks
19 issues

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing samber/mo in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/samber/mo)
Preview:Analyzed by RepoMind

Repository Overview (README excerpt)

Crawler view

mo - Monads 🦄 ** brings monads and popular FP abstractions to Go projects. uses the recent Go 1.18+ Generics.** **Inspired by:** • Scala • Rust • FP-TS **See also:** • samber/ro: Reactive Programming for Go: declarative and composable API for event-driven applications • samber/lo: A Lodash-style Go library based on Go 1.18+ Generics • samber/do: A dependency injection toolkit based on Go 1.18+ Generics • samber/cc-skills-golang: AI Agent Skills for Golang ---- 💖 Sponsored by: DBOS - Durable workflow orchestration library for Go ---- **Why this name?** I love **short name** for such utility library. This name is similar to "Monad Go" and no Go package uses this name. 💡 Features We currently support the following data types: • (Maybe) • • • (With X between 3 and 5) • • • • • • 🚀 Install This library is v1 and follows SemVer strictly. No breaking changes will be made to exported APIs before v2.0.0. This library has no dependencies except the Go std lib. 💡 Quick start You can import using: Quick example using the sub-package to compose transformations: Then use one of the helpers below: More examples in documentation. Tips for lazy developers I cannot recommend it, but in case you are too lazy for repeating everywhere, you can import the entire library into the namespace. I take no responsibility on this junk. 😁 💩 🤠 Documentation and examples GoDoc: https://godoc.org/github.com/samber/mo Option[T any] is a container for an optional value of type . If value exists, is of type . If the value is absent, is of type . Implements: • Constructors: • doc - play • doc - play • doc - play • doc - play • doc - play Methods: • doc - play • doc - play • doc - play • doc - play • doc - play • doc - play • doc - play • doc - play • doc - play • doc - play • doc • doc - play • doc - play • doc - play • doc • doc - play • doc • doc • doc • doc • doc • doc • doc • doc • doc • doc Other: • doc Sub-package (transformations and pipes): • doc • doc • doc • doc • docs Result[T any] respresent a result of an action having one of the following output: success or failure. An instance of is an instance of either or . It could be compared to . Implements: • Constructors: • doc - play • doc - play • doc - play • doc - play • doc - play Methods: • doc - play • doc - play • doc - play • doc - play • doc - play • doc - play • doc - play • doc - play • doc - play • doc - play • doc - play • doc - play • doc - play • doc - play Other: • doc • doc Sub-package (transformations and pipes): • doc • doc • doc • doc • docs Either[L any, R any] represents a value of 2 possible types. An instance of is an instance of either or . Implements: • Constructors: • doc • doc Methods: • doc • doc • doc • doc • doc • doc • doc • doc • doc • doc • doc • doc • doc • doc • doc • doc Other: • doc Sub-package (transformations and pipes): • doc • doc • doc • doc • docs EitherX[T1, ..., TX] (With X between 3 and 5) respresents a value of X possible types. For example, an value is either , or . Constructors: • doc. Eg: • - • - • - ... Methods: • doc • doc • doc • doc • doc • doc • doc • doc • doc Sub-packages , , (transformations and pipes): • either3 docs: https://pkg.go.dev/github.com/samber/mo/either3 • doc • doc • doc • doc • docs • either4 docs: https://pkg.go.dev/github.com/samber/mo/either4 • doc • doc • doc • doc • docs • either5 docs: https://pkg.go.dev/github.com/samber/mo/either5 • doc • doc • doc • doc • docs Future[T any] represents a value which may or may not currently be available, but will be available at some point, or an exception if that value could not be made available. Constructors: • doc Methods: • doc • doc • doc • doc • doc • doc IO[T any] represents a non-deterministic synchronous computation that can cause side effects, yields a value of type and never fails. Constructors: • doc • doc • doc • doc • doc • doc Methods: • doc IOEither[T any] represents a non-deterministic synchronous computation that can cause side effects, yields a value of type and can fail. Constructors: • doc • doc • doc • doc • doc • doc Methods: • doc Task[T any] represents a non-deterministic asynchronous computation that can cause side effects, yields a value of type and never fails. Constructors: • doc • doc • doc • doc • doc • doc • doc • doc • doc • doc • doc • doc Methods: • doc TaskEither[T any] represents a non-deterministic asynchronous computation that can cause side effects, yields a value of type and can fail. Constructors: • [doc](https: _...truncated for preview_