type
Maybe[T] = object
case hasValue*: bool
of true:
value*: T
of false: nil
It works fine. However following code does not compile - logically I wanted to declare the hasValue type and then use case statement.
type
Maybe[T] = object
hasValue*: bool
case hasValue*:
of true:
value*: T
of false: nil