It's not clear to me at all from the README or from the generated code, how to create the bottom value (or Nothing in Haskell parlance).
I have this generated code:
// OptionalFlavor is an optional Flavor.
type OptionalFlavor struct {
value *Flavor
}
// NewOptionalFlavor creates an optional.OptionalFlavor from a Flavor.
func NewOptionalFlavor(v Flavor) OptionalFlavor {
return OptionalFlavor{&v}
}
so if I have a Flavor I know how to get an OptionalFlavor. What I expected to find here was a nullary function that returns the Nothing case.
Perhaps I don't understand how this is supposed to work, or the README needs clarification.
Tangentially, being a sum type, I expected there to be a tag field in the generated struct. So I would like to know how the Nothing case is actually represented (Sorry, I'm new to golang).
It's not clear to me at all from the README or from the generated code, how to create the bottom value (or
Nothing
in Haskell parlance).I have this generated code:
so if I have a
Flavor
I know how to get anOptionalFlavor
. What I expected to find here was a nullary function that returns theNothing
case.Perhaps I don't understand how this is supposed to work, or the README needs clarification.