You are right, the two versions are exactly the same. The second parameter of keepIf
is the "default value" to signal if the given condition does not hold. So the signal will be itself if it is Just, and Nothing if it is Nothing. :) I already filed a pull request: https://github.com/evancz/elm-lang.org/pull/18
What is the purpose of the `keepIf` in Elm's zip code example?
-
12-01-2022 - |
Question
In the zip code example, there is the line:
responses = sendGet (fromMaybe "" <~ keepIf isJust Nothing realInput)
where realInput :: Maybe String
. It seems to me that this can be reduced to:
responses = sendGet (fromMaybe "" <~ realInput)
Is there any difference?
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow