This module defines types and functions for working with nullable types using the FFI.
data Nullable t0
The runtime representation of
Nullable T is the same as that of
except that it may also be
[1,2,3] may all be given the type
[1,2,null,3] may all be given the type
Array (Nullable Int).
There is one pitfall with
Nullable, which is that values of the type
Nullable T will not function as you might expect if the type
to itself permit
null as a valid runtime representation.
In particular, values of the type
Nullable (Nullable T) will ‘collapse’,
in the sense that the PureScript expressions
notNull null and
will both leave you with a value whose runtime representation is just
null. Therefore it is important to avoid using
Nullable T in
T itself can take
null as a runtime representation.
If in doubt, use
Nullable does not permit lawful
instances as a result of this pitfall, which is why these instances are