To be honest, no, if I set T to *int, then get will return *int, not int, so T must not be nillable type.
在2023年3月19日星期日 UTC+8 02:02:00<TheDiveO> 写道: > How could I forget https://github.com/samber/mo...? > > On Saturday, March 18, 2023 at 7:00:03 PM UTC+1 TheDiveO wrote: > >> Maybe (no pun intended) implementations like >> https://github.com/OlegStotsky/go-monads and >> https://github.com/TeaEntityLab/fpGo can shed some more light on your >> question and implementation designs? >> >> On Saturday, March 18, 2023 at 11:37:59 AM UTC+1 李晓辉 wrote: >> >>> When I want to implement a Maybe[T any] type, the T can't be nil, but I >>> can't find way to constraint this, can anyone give helps. >> >> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/68ae0dac-eb48-4df3-a888-ffb789cdc407n%40googlegroups.com.