mo icon indicating copy to clipboard operation
mo copied to clipboard

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

Results 32 mo issues
Sort by recently updated
recently updated
newest added

As stated on the package doc: > The functions provided by this package are not methods of `mo.Option` due to the lack of method type parameters > on methods. This...

I guess we could have: ```go type Either3[T1 any, T2 any, T3 any] struct { argId int arg1 T1 arg2 T2 arg3 T3 } ``` Constructors: mo.CreateEither3Arg1() mo.CreateEither3Arg2() mo.CreateEither3Arg3() Methods:...

Could we have a helper function like the following for `Either`? ```go func Map[T any](e Either[L, R], onLeft func(L) T, onRight func(R) T) T ``` It would be useful to...

If m and n are two Option[int], I want to add them up. How can I finish this? I learnt haskell these days and it uses applicative (a special functor)...

At this moment we cant use monads to translate between different Result monad types. Ex `Ok(42).FlatMap(func(int) Result[string] { return Ok("wont work") })` because of the single type constraint introduced in...

Hi, Most of the times we returns a constant for the `Map` method on the Option receiver. For example, we might have something like : ```go mo.Some("foobar").Map(func(value string) (string, bool)...

For example `CREATE TABLE `t` (`optional` VARCHAR(64));` ``` rows, err := db.Query("SELECT optional FROM t LIMIT 1?") for rows.Next() { var o mo.Option[string] if err := rows.Scan(&o); err != nil...

I'd love to have a struct that has a field Option[T] and could hide elements when they are unpresent like `omitempty` does Did you face the same issue? Did you...

``` Scala: def map[B](f: (A) ? B): Traversable[B] Golang: func (r Result[T]) Map(mapper func(value T) (T, error)) Result[T] ``` Generally the map function supports type transformations from `T[A] => T[B]`...