You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
basically this is the other end of samber/mo#40 -- implement .Get() -> (T, U, V, ...) for the Tuple family of types instead of having samber/mo's Result and Option implement .Unpack()
why do I want this? so that I can use https://github.com/samber/mo Option Result and this package's Tuple interchangeably and just return an interface like this:
typemyGet[Tany, Uany] interface {
Get() (T, U)
}
funcMyFunc() <-chanmyGet[int, error] {
c:=make(chanmyGet[int, error])
gofunc(){
deferclose(c)
time.Sleep(200*time.Milliseconds)
// c <- mo.Option// c <- lo.Tuple2// c <- mo.Result// c <- whatever
}()
returnc
}
import"github.com/jcbhmr/thelib"funcmain() {
v, err:= (<-thelib.MyFunc()).Get()
iferr!=nil {
log.Fatal(err)
}
log.Printf("The result is %d", v)
}
tldr: id like to see Unpack() or Get() be a common func among samber/lo and samber/mo so that I can return an interface abstracting over the library data structs that I use and just say "run .Unpack()" or "run .Get()"
The text was updated successfully, but these errors were encountered:
jcbhmr
changed the title
Add .Get() to Tuple family as common alias for .Unpack() to match samber/mo
Add .Get() to Tuple family as alias for .Unpack() to match samber/mo
Apr 26, 2024
basically this is the other end of samber/mo#40 -- implement .Get() -> (T, U, V, ...) for the Tuple family of types instead of having samber/mo's Result and Option implement .Unpack()
why do I want this? so that I can use https://github.com/samber/mo Option Result and this package's Tuple interchangeably and just return an interface like this:
tldr: id like to see Unpack() or Get() be a common func among samber/lo and samber/mo so that I can return an interface abstracting over the library data structs that I use and just say "run .Unpack()" or "run .Get()"
The text was updated successfully, but these errors were encountered: