Open
Description
The key feature of the Maybe
monad implementation is its strict typing. For example, the type of just().value
is always T
.
But the type of nothing().value
and nil().value
is null | undefined
, even internally these two functions create Nothing
with either undefined
or null
.
This can be improved by making the Nothing
class abstract
and introducing two concrete classes Nil
and None
with null
and undefined
values only.