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?

Était-ce utile?

La solution

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top