It changes from null being expected to. A Maybe being expected. So Nothing is a valid input.
When you use map, it will work on both a Just and a Nothing.
map
Just
Nothing
So you can stop guards completely!
This is a good example of what I am talking about:
const toUpper = string => string.toUpperCase() map (toUpper) (Just ("abc")) //=> Just ('ABC') map (toUpper) (Nothing) //=> Nothing
You don't have to worry about if the value is a Just or a Nothing. You just accept a Maybe.
Maybe
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It changes from null being expected to. A Maybe being expected. So Nothing is a valid input.
When you use
map
, it will work on both aJust
and aNothing
.So you can stop guards completely!
This is a good example of what I am talking about:
You don't have to worry about if the value is a
Just
or aNothing
. You just accept aMaybe
.