3 ms·
Most languages, sure, but not all; Haskell doesn’t have NULL. You can express the absense of a value with a Maybe: Just “value” -> Maybe String Nothing
by ancarda 8y ago
Most languages, sure, but not all; Haskell doesn’t have NULL. You can express the absense of a value with a Maybe:
Just “value” -> Maybe String
Nothing -> Maybe a
If your function returns a “Maybe String”, it can either be just a value, or Nothing. However, if a function returns a “String”, you can’t return Nothing, only an actual String.
There’s no null in Haskell.