{"id":13412910,"url":"https://github.com/samber/mo","last_synced_at":"2025-05-14T07:07:37.436Z","repository":{"id":37667862,"uuid":"493439811","full_name":"samber/mo","owner":"samber","description":"🦄  Monads and popular FP abstractions, powered by Go 1.18+ Generics (Option, Result, Either...)","archived":false,"fork":false,"pushed_at":"2025-05-06T10:32:09.000Z","size":193,"stargazers_count":2948,"open_issues_count":24,"forks_count":96,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-05-07T06:38:32.746Z","etag":null,"topics":["cats","either","fp","functional","future","generics","go","golang","io","maybe","monad","monoid","option","optional","programming","result","state","task","typesafe"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/samber/mo","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samber.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["samber"]}},"created_at":"2022-05-17T23:07:48.000Z","updated_at":"2025-05-07T03:25:21.000Z","dependencies_parsed_at":"2024-01-08T15:02:53.562Z","dependency_job_id":"9a88272b-153a-450c-9d3b-b940a23ef5cc","html_url":"https://github.com/samber/mo","commit_stats":{"total_commits":58,"total_committers":11,"mean_commits":"5.2727272727272725","dds":"0.27586206896551724","last_synced_commit":"88450dd998c13cced954149c4f92e87fad25af3d"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samber%2Fmo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samber%2Fmo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samber%2Fmo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samber%2Fmo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samber","download_url":"https://codeload.github.com/samber/mo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254092648,"owners_count":22013290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cats","either","fp","functional","future","generics","go","golang","io","maybe","monad","monoid","option","optional","programming","result","state","task","typesafe"],"created_at":"2024-07-30T20:01:30.952Z","updated_at":"2025-05-14T07:07:37.415Z","avatar_url":"https://github.com/samber.png","language":"Go","readme":"# mo - Monads\n\n[![tag](https://img.shields.io/github/tag/samber/mo.svg)](https://github.com/samber/mo/releases)\n![Go Version](https://img.shields.io/badge/Go-%3E%3D%201.18-%23007d9c)\n[![GoDoc](https://godoc.org/github.com/samber/mo?status.svg)](https://pkg.go.dev/github.com/samber/mo)\n![Build Status](https://github.com/samber/mo/actions/workflows/test.yml/badge.svg)\n[![Go report](https://goreportcard.com/badge/github.com/samber/mo)](https://goreportcard.com/report/github.com/samber/mo)\n[![Coverage](https://img.shields.io/codecov/c/github/samber/do)](https://codecov.io/gh/samber/mo)\n[![License](https://img.shields.io/github/license/samber/mo)](./LICENSE)\n\n🦄 **`samber/mo` brings monads and popular FP abstractions to Go projects. `samber/mo` uses the recent Go 1.18+ Generics.**\n\n**Inspired by:**\n\n- Scala\n- Rust\n- FP-TS\n\n**See also:**\n\n- [samber/lo](https://github.com/samber/lo): A Lodash-style Go library based on Go 1.18+ Generics\n- [samber/do](https://github.com/samber/do): A dependency injection toolkit based on Go 1.18+ Generics\n\n**Why this name?**\n\nI love **short name** for such utility library. This name is similar to \"Monad Go\" and no Go package uses this name.\n\n## 💡 Features\n\nWe currently support the following data types:\n\n- `Option[T]` (Maybe)\n- `Result[T]`\n- `Either[A, B]`\n- `EitherX[T1, ..., TX]` (With X between 3 and 5)\n- `Future[T]`\n- `IO[T]`\n- `IOEither[T]`\n- `Task[T]`\n- `TaskEither[T]`\n- `State[S, A]`\n\n## 🚀 Install\n\n```sh\ngo get github.com/samber/mo@v1\n```\n\nThis library is v1 and follows SemVer strictly.\n\nNo breaking changes will be made to exported APIs before v2.0.0.\n\nThis library has no dependencies except the Go std lib.\n\n## 💡 Quick start\n\nYou can import `mo` using:\n\n```go\nimport (\n    \"github.com/samber/mo\"\n)\n```\n\nThen use one of the helpers below:\n\n```go\noption1 := mo.Some(42)\n// Some(42)\n\noption1.\n    FlatMap(func (value int) Option[int] {\n        return Some(value*2)\n    }).\n    FlatMap(func (value int) Option[int] {\n        return Some(value%2)\n    }).\n    FlatMap(func (value int) Option[int] {\n        return Some(value+21)\n    }).\n    OrElse(1234)\n// 21\n\noption2 := mo.None[int]()\n// None\n\noption2.OrElse(1234)\n// 1234\n\noption3 := option1.Match(\n    func(i int) (int, bool) {\n        // when value is present\n        return i * 2, true\n    },\n    func() (int, bool) {\n        // when value is absent\n        return 0, false\n    },\n)\n// Some(42)\n```\n\nMore examples in [documentation](https://godoc.org/github.com/samber/mo).\n\n### Tips for lazy developers\n\nI cannot recommend it, but in case you are too lazy for repeating `mo.` everywhere, you can import the entire library into the namespace.\n\n```go\nimport (\n    . \"github.com/samber/mo\"\n)\n```\n\nI take no responsibility on this junk. 😁 💩\n\n## 🤠 Documentation and examples\n\n[GoDoc: https://godoc.org/github.com/samber/mo](https://godoc.org/github.com/samber/mo)\n\n### Option[T any]\n\n`Option` is a container for an optional value of type `T`. If value exists, `Option` is of type `Some`. If the value is absent, `Option` is of type `None`.\n\nImplements:\n- `mo.Foldable[T, U]`\n\nConstructors:\n\n- `mo.Some()` [doc](https://pkg.go.dev/github.com/samber/mo#Some) - [play](https://go.dev/play/p/iqz2n9n0tDM)\n- `mo.None()` [doc](https://pkg.go.dev/github.com/samber/mo#None) - [play](https://go.dev/play/p/yYQPsYCSYlD)\n- `mo.TupleToOption()` [doc](https://pkg.go.dev/github.com/samber/mo#TupleToOption) - [play](https://go.dev/play/p/gkrg2pZwOty)\n- `mo.EmptyableToOption()` [doc](https://pkg.go.dev/github.com/samber/mo#EmptyableToOption) - [play](https://go.dev/play/p/GSpQQ-q-UES)\n- `mo.PointerToOption()` [doc](https://pkg.go.dev/github.com/samber/mo#PointerToOption) - [play](https://go.dev/play/p/yPVMj4DUb-I)\n\nMethods:\n\n- `.IsPresent()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.IsPresent) - [play](https://go.dev/play/p/nDqIaiihyCA)\n- `.IsAbsent()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.IsAbsent) - [play](https://go.dev/play/p/23e2zqyVOQm)\n- `.Size()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.Size) - [play](https://go.dev/play/p/7ixCNG1E9l7)\n- `.Get()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.Get) - [play](https://go.dev/play/p/0-JBa1usZRT)\n- `.MustGet()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.MustGet) - [play](https://go.dev/play/p/RVBckjdi5WR)\n- `.OrElse()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.OrElse) - [play](https://go.dev/play/p/TrGByFWCzXS)\n- `.OrEmpty()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.OrEmpty) - [play](https://go.dev/play/p/SpSUJcE-tQm)\n- `.ToPointer()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.ToPointer) - [play](https://go.dev/play/p/N43w92SM-Bs)\n- `.ForEach()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.ForEach)\n- `.Match()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.Match) - [play](https://go.dev/play/p/1V6st3LDJsM)\n- `.Map()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.Map) - [play](https://go.dev/play/p/mvfP3pcP_eJ)\n- `.MapNone()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.MapNone) - [play](https://go.dev/play/p/_KaHWZ6Q17b)\n- `.FlatMap()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.FlatMap) - [play](https://go.dev/play/p/OXO-zJx6n5r)\n- `.MarshalJSON()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.MarshalJSON)\n- `.UnmarshalJSON()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.UnmarshalJSON)\n- `.MarshalText()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.MarshalText)\n- `.UnmarshalText()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.UnmarshalText)\n- `.MarshalBinary()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.MarshalBinary)\n- `.UnmarshalBinary()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.UnmarshalBinary)\n- `.GobEncode()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.GobEncode)\n- `.GobDecode()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.GobDecode)\n- `.Scan()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.Scan)\n- `.Value()` [doc](https://pkg.go.dev/github.com/samber/mo#Option.Value)\n\nOther:\n\n- `mo.Fold[T, U, R any](f Foldable[T, U], successFunc func(U) R, failureFunc func(T) R) R` [doc](https://pkg.go.dev/github.com/samber/mo#Fold)\n\n### Result[T any]\n\n`Result` respresent a result of an action having one of the following output: success or failure. An instance of `Result` is an instance of either `Ok` or `Err`. It could be compared to `Either[error, T]`.\n\nImplements:\n- `mo.Foldable[T, U]`\n\nConstructors:\n\n- `mo.Ok()` [doc](https://pkg.go.dev/github.com/samber/mo#Ok) - [play](https://go.dev/play/p/PDwADdzNoyZ)\n- `mo.Err()` [doc](https://pkg.go.dev/github.com/samber/mo#Err) - [play](https://go.dev/play/p/PDwADdzNoyZ)\n- `mo.Errf()` [doc](https://pkg.go.dev/github.com/samber/mo#Errf) - [play](https://go.dev/play/p/N43w92SM-Bs)\n- `mo.TupleToResult()` [doc](https://pkg.go.dev/github.com/samber/mo#TupleToResult) - [play](https://go.dev/play/p/KWjfqQDHQwa)\n- `mo.Try()` [doc](https://pkg.go.dev/github.com/samber/mo#Try) - [play](https://go.dev/play/p/ilOlQx-Mx42)\n\nMethods:\n\n- `.IsOk()` [doc](https://pkg.go.dev/github.com/samber/mo#Result.IsOk) - [play](https://go.dev/play/p/sfNvBQyZfgU)\n- `.IsError()` [doc](https://pkg.go.dev/github.com/samber/mo#Result.IsError) - [play](https://go.dev/play/p/xkV9d464scV)\n- `.Error()` [doc](https://pkg.go.dev/github.com/samber/mo#Result.Error) - [play](https://go.dev/play/p/CSkHGTyiXJ5)\n- `.Get()` [doc](https://pkg.go.dev/github.com/samber/mo#Result.Get) - [play](https://go.dev/play/p/8KyX3z6TuNo)\n- `.MustGet()` [doc](https://pkg.go.dev/github.com/samber/mo#Result.MustGet) - [play](https://go.dev/play/p/8LSlndHoTAE)\n- `.OrElse()` [doc](https://pkg.go.dev/github.com/samber/mo#Result.OrElse) - [play](https://go.dev/play/p/MN_ULx0soi6)\n- `.OrEmpty()` [doc](https://pkg.go.dev/github.com/samber/mo#Result.OrEmpty) - [play](https://go.dev/play/p/rdKtBmOcMLh)\n- `.ToEither()` [doc](https://pkg.go.dev/github.com/samber/mo#Result.ToEither) - [play](https://go.dev/play/p/Uw1Zz6b952q)\n- `.ForEach()` [doc](https://pkg.go.dev/github.com/samber/mo#Result.ForEach)\n- `.Match()` [doc](https://pkg.go.dev/github.com/samber/mo#Result.Match) - [play](https://go.dev/play/p/-_eFaLJ31co)\n- `.Map()` [doc](https://pkg.go.dev/github.com/samber/mo#Result.Map) - [play](https://go.dev/play/p/-ndpN_b_OSc)\n- `.MapErr()` [doc](https://pkg.go.dev/github.com/samber/mo#Result.MapErr) - [play](https://go.dev/play/p/WraZixg9GGf)\n- `.FlatMap()` [doc](https://pkg.go.dev/github.com/samber/mo#Result.FlatMap) - [play](https://go.dev/play/p/Ud5QjZOqg-7)\n\nOther:\n\n- `mo.Fold[T, U, R any](f Foldable[T, U], successFunc func(U) R, failureFunc func(T) R) R` [doc](https://pkg.go.dev/github.com/samber/mo#Fold)\n- `mo.Do[T any](fn func() T) (result mo.Result[T])` [doc](https://pkg.go.dev/github.com/samber/mo#Do)\n\n### Either[L any, R any]\n\n`Either` represents a value of 2 possible types. An instance of `Either` is an instance of either `A` or `B`.\n\nImplements:\n- `mo.Foldable[T, U]`\n\nConstructors:\n\n- `mo.Left()` [doc](https://pkg.go.dev/github.com/samber/mo#Left)\n- `mo.Right()` [doc](https://pkg.go.dev/github.com/samber/mo#Right)\n\nMethods:\n\n- `.IsLeft()` [doc](https://pkg.go.dev/github.com/samber/mo#Either.IsLeft)\n- `.IsRight()` [doc](https://pkg.go.dev/github.com/samber/mo#Either.IsRight)\n- `.Left()` [doc](https://pkg.go.dev/github.com/samber/mo#Either.Left)\n- `.Right()` [doc](https://pkg.go.dev/github.com/samber/mo#Either.Right)\n- `.MustLeft()` [doc](https://pkg.go.dev/github.com/samber/mo#Either.MustLeft)\n- `.MustRight()` [doc](https://pkg.go.dev/github.com/samber/mo#Either.MustRight)\n- `.Unpack()` [doc](https://pkg.go.dev/github.com/samber/mo#Either.Unpack)\n- `.LeftOrElse()` [doc](https://pkg.go.dev/github.com/samber/mo#Either.LeftOrElse)\n- `.RightOrElse()` [doc](https://pkg.go.dev/github.com/samber/mo#Either.RightOrElse)\n- `.LeftOrEmpty()` [doc](https://pkg.go.dev/github.com/samber/mo#Either.LeftOrEmpty)\n- `.RightOrEmpty()` [doc](https://pkg.go.dev/github.com/samber/mo#Either.RightOrEmpty)\n- `.Swap()` [doc](https://pkg.go.dev/github.com/samber/mo#Either.Swap)\n- `.ForEach()` [doc](https://pkg.go.dev/github.com/samber/mo#Either.ForEach)\n- `.Match()` [doc](https://pkg.go.dev/github.com/samber/mo#Either.Match)\n- `.MapLeft()` [doc](https://pkg.go.dev/github.com/samber/mo#Either.MapLeft)\n- `.MapRight()` [doc](https://pkg.go.dev/github.com/samber/mo#Either.MapRight)\n\nOther:\n\n- `mo.Fold[T, U, R any](f Foldable[T, U], successFunc func(U) R, failureFunc func(T) R) R` [doc](https://pkg.go.dev/github.com/samber/mo#Fold)\n\n### EitherX[T1, ..., TX] (With X between 3 and 5)\n\n`EitherX` respresents a value of X possible types. For example, an `Either3` value is either `T1`, `T2` or `T3`.\n\nConstructors:\n\n- `mo.NewEitherXArgY()` [doc](https://pkg.go.dev/github.com/samber/mo#NewEither5Arg1). Eg:\n  - `mo.NewEither3Arg1[A, B, C](A)`\n  - `mo.NewEither3Arg2[A, B, C](B)`\n  - `mo.NewEither3Arg3[A, B, C](C)`\n  - `mo.NewEither4Arg1[A, B, C, D](A)`\n  - `mo.NewEither4Arg2[A, B, C, D](B)`\n  - ...\n\nMethods:\n\n- `.IsArgX()` [doc](https://pkg.go.dev/github.com/samber/mo#Either5.IsArg1)\n- `.ArgX()` [doc](https://pkg.go.dev/github.com/samber/mo#Either5.Arg1)\n- `.MustArgX()` [doc](https://pkg.go.dev/github.com/samber/mo#Either5.MustArg1)\n- `.Unpack()` [doc](https://pkg.go.dev/github.com/samber/mo#Either5.Unpack)\n- `.ArgXOrElse()` [doc](https://pkg.go.dev/github.com/samber/mo#Either5.Arg1OrElse)\n- `.ArgXOrEmpty()` [doc](https://pkg.go.dev/github.com/samber/mo#Either5.Arg1OrEmpty)\n- `.ForEach()` [doc](https://pkg.go.dev/github.com/samber/mo#Either5.ForEach)\n- `.Match()` [doc](https://pkg.go.dev/github.com/samber/mo#Either5.Match)\n- `.MapArgX()` [doc](https://pkg.go.dev/github.com/samber/mo#Either5.MapArg1)\n\n### Future[T any]\n\n`Future` 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.\n\nConstructors:\n\n- `mo.NewFuture()` [doc](https://pkg.go.dev/github.com/samber/mo#NewFuture)\n\nMethods:\n\n- `.Then()` [doc](https://pkg.go.dev/github.com/samber/mo#Future.Then)\n- `.Catch()` [doc](https://pkg.go.dev/github.com/samber/mo#Future.Catch)\n- `.Finally()` [doc](https://pkg.go.dev/github.com/samber/mo#Future.Finally)\n- `.Collect()` [doc](https://pkg.go.dev/github.com/samber/mo#Future.Collect)\n- `.Result()` [doc](https://pkg.go.dev/github.com/samber/mo#Future.Result)\n- `.Cancel()` [doc](https://pkg.go.dev/github.com/samber/mo#Future.Cancel)\n\n### IO[T any]\n\n`IO` represents a non-deterministic synchronous computation that can cause side effects, yields a value of type `R` and never fails.\n\nConstructors:\n\n- `mo.NewIO()` [doc](https://pkg.go.dev/github.com/samber/mo#NewIO)\n- `mo.NewIO1()` [doc](https://pkg.go.dev/github.com/samber/mo#NewIO1)\n- `mo.NewIO2()` [doc](https://pkg.go.dev/github.com/samber/mo#NewIO2)\n- `mo.NewIO3()` [doc](https://pkg.go.dev/github.com/samber/mo#NewIO3)\n- `mo.NewIO4()` [doc](https://pkg.go.dev/github.com/samber/mo#NewIO4)\n- `mo.NewIO5()` [doc](https://pkg.go.dev/github.com/samber/mo#NewIO5)\n\nMethods:\n\n- `.Run()` [doc](https://pkg.go.dev/github.com/samber/mo#Future.Run)\n\n### IOEither[T any]\n\n`IO` represents a non-deterministic synchronous computation that can cause side effects, yields a value of type `R` and can fail.\n\nConstructors:\n\n- `mo.NewIOEither()` [doc](https://pkg.go.dev/github.com/samber/mo#NewIOEither)\n- `mo.NewIOEither1()` [doc](https://pkg.go.dev/github.com/samber/mo#NewIOEither1)\n- `mo.NewIOEither2()` [doc](https://pkg.go.dev/github.com/samber/mo#NewIOEither2)\n- `mo.NewIOEither3()` [doc](https://pkg.go.dev/github.com/samber/mo#NewIOEither3)\n- `mo.NewIOEither4()` [doc](https://pkg.go.dev/github.com/samber/mo#NewIOEither4)\n- `mo.NewIOEither5()` [doc](https://pkg.go.dev/github.com/samber/mo#NewIOEither5)\n\nMethods:\n\n- `.Run()` [doc](https://pkg.go.dev/github.com/samber/mo#IOEither.Run)\n\n### Task[T any]\n\n`Task` represents a non-deterministic asynchronous computation that can cause side effects, yields a value of type `R` and never fails.\n\nConstructors:\n\n- `mo.NewTask()` [doc](https://pkg.go.dev/github.com/samber/mo#NewTask)\n- `mo.NewTask1()` [doc](https://pkg.go.dev/github.com/samber/mo#NewTask1)\n- `mo.NewTask2()` [doc](https://pkg.go.dev/github.com/samber/mo#NewTask2)\n- `mo.NewTask3()` [doc](https://pkg.go.dev/github.com/samber/mo#NewTask3)\n- `mo.NewTask4()` [doc](https://pkg.go.dev/github.com/samber/mo#NewTask4)\n- `mo.NewTask5()` [doc](https://pkg.go.dev/github.com/samber/mo#NewTask5)\n- `mo.NewTaskFromIO()` [doc](https://pkg.go.dev/github.com/samber/mo#NewTaskFromIO)\n- `mo.NewTaskFromIO1()` [doc](https://pkg.go.dev/github.com/samber/mo#NewTaskFromIO1)\n- `mo.NewTaskFromIO2()` [doc](https://pkg.go.dev/github.com/samber/mo#NewTaskFromIO2)\n- `mo.NewTaskFromIO3()` [doc](https://pkg.go.dev/github.com/samber/mo#NewTaskFromIO3)\n- `mo.NewTaskFromIO4()` [doc](https://pkg.go.dev/github.com/samber/mo#NewTaskFromIO4)\n- `mo.NewTaskFromIO5()` [doc](https://pkg.go.dev/github.com/samber/mo#NewTaskFromIO5)\n\nMethods:\n\n- `.Run()` [doc](https://pkg.go.dev/github.com/samber/mo#Task.Run)\n\n### TaskEither[T any]\n\n`TaskEither` represents a non-deterministic asynchronous computation that can cause side effects, yields a value of type `R` and can fail.\n\nConstructors:\n\n- `mo.NewTaskEither()` [doc](https://pkg.go.dev/github.com/samber/mo#NewTaskEither)\n- `mo.NewTaskEitherFromIOEither()` [doc](https://pkg.go.dev/github.com/samber/mo#NewTaskEitherFromIOEither)\n\nMethods:\n\n- `.Run()` [doc](https://pkg.go.dev/github.com/samber/mo#TaskEither.Run)\n- `.OrElse()` [doc](https://pkg.go.dev/github.com/samber/mo#TaskEither.OrElse)\n- `.Match()` [doc](https://pkg.go.dev/github.com/samber/mo#TaskEither.Match)\n- `.TryCatch()` [doc](https://pkg.go.dev/github.com/samber/mo#TaskEither.TryCatch)\n- `.ToTask()` [doc](https://pkg.go.dev/github.com/samber/mo#TaskEither.ToTask)\n- `.ToEither()` [doc](https://pkg.go.dev/github.com/samber/mo#TaskEither.ToEither)\n\n### State[S any, A any]\n\n`State` represents a function `(S) -\u003e (A, S)`, where `S` is state, `A` is result.\n\nConstructors:\n\n- `mo.NewState()` [doc](https://pkg.go.dev/github.com/samber/mo#NewState)\n- `mo.ReturnState()` [doc](https://pkg.go.dev/github.com/samber/mo#ReturnState)\n\nMethods:\n\n- `.Run()` [doc](https://pkg.go.dev/github.com/samber/mo#TaskEither.Run)\n- `.Get()` [doc](https://pkg.go.dev/github.com/samber/mo#TaskEither.Get)\n- `.Modify()` [doc](https://pkg.go.dev/github.com/samber/mo#TaskEither.Modify)\n- `.Put()` [doc](https://pkg.go.dev/github.com/samber/mo#TaskEither.Put)\n\n### Foldable[T, U]\n\nFoldable represents a type that can be folded into a single value based on its state.\n\n- `mo.Fold[T, U, R any](f Foldable[T, U], successFunc func(U) R, failureFunc func(T) R) R` [doc](https://pkg.go.dev/github.com/samber/mo#Fold)\n\n## 🛩 Benchmark\n\n// @TODO\n\nThis library does not use `reflect` package. We don't expect overhead.\n\n## 🤝 Contributing\n\n- Ping me on Twitter [@samuelberthe](https://twitter.com/samuelberthe) (DMs, mentions, whatever :))\n- Fork the [project](https://github.com/samber/mo)\n- Fix [open issues](https://github.com/samber/mo/issues) or request new features\n\nDon't hesitate ;)\n\n### With Docker\n\n```bash\ndocker-compose run --rm dev\n```\n\n### Without Docker\n\n```bash\n# Install some dev dependencies\nmake tools\n\n# Run tests\nmake test\n# or\nmake watch-test\n```\n\n## 👤 Contributors\n\n![Contributors](https://contrib.rocks/image?repo=samber/mo)\n\n## 💫 Show your support\n\nGive a ⭐️ if this project helped you!\n\n[![GitHub Sponsors](https://img.shields.io/github/sponsors/samber?style=for-the-badge)](https://github.com/sponsors/samber)\n\n## 📝 License\n\nCopyright © 2022 [Samuel Berthe](https://github.com/samber).\n\nThis project is [MIT](./LICENSE) licensed.\n","funding_links":["https://github.com/sponsors/samber"],"categories":["Functional","Go","方法"],"sub_categories":["Search and Analytic Databases","Advanced Console UIs","检索及分析资料库"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamber%2Fmo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamber%2Fmo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamber%2Fmo/lists"}