Maybe is just another Optional type, but with a much weirder name, so that's pretty obvious. But this makes me wonder - does Haskell optimize `Maybe`-like types down to a null-pointer, like Rust does?
null pointers can be encoded as an option type[0] (that's basically what languages like Swift or Rust do, they eschew nullable pointers and wrap non-nullable pointers in an option type instead), but they are not because
1. you don't have the attending type-safety of knowing that some pointers can't be null
2. the compiler requiring checking for nullity before every pointer access would be horrendously unwieldy
[0] which can then be compiled back to a regular nullable pointer at runtime
Nulls can be nested if you are using a language with explicit pointer types.
E.g.,
Int*** x;
Can be a lot like
Maybe Maybe Maybe Int
It's just that in languages where a type like Integer really means “an integer or a null", the nullability doesn't nest, and no one wants to deal with naked pointers.