mirror of
https://github.com/IBM/fp-go.git
synced 2025-08-10 22:31:32 +02:00
fix: support Alt for IOOption (#84)
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
ET "github.com/IBM/fp-go/either"
|
||||
I "github.com/IBM/fp-go/io"
|
||||
G "github.com/IBM/fp-go/iooption/generic"
|
||||
L "github.com/IBM/fp-go/lazy"
|
||||
O "github.com/IBM/fp-go/option"
|
||||
)
|
||||
|
||||
@@ -132,3 +133,13 @@ func Defer[A any](gen func() IOOption[A]) IOOption[A] {
|
||||
func FromEither[E, A any](e ET.Either[E, A]) IOOption[A] {
|
||||
return G.FromEither[IOOption[A]](e)
|
||||
}
|
||||
|
||||
// MonadAlt identifies an associative operation on a type constructor
|
||||
func MonadAlt[A any](first IOOption[A], second L.Lazy[IOOption[A]]) IOOption[A] {
|
||||
return G.MonadAlt(first, second)
|
||||
}
|
||||
|
||||
// Alt identifies an associative operation on a type constructor
|
||||
func Alt[A any](second L.Lazy[IOOption[A]]) func(IOOption[A]) IOOption[A] {
|
||||
return G.Alt(second)
|
||||
}
|
||||
|
Reference in New Issue
Block a user