Created
February 21, 2017 23:40
-
-
Save marick/59466293a3f40052fab8c5e206d630a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-! If there is an original animal to work with, partially apply the | |
given function to that animal. The given function is expected to | |
transform some value with that function. If there is no animal, | |
`identity` is used. | |
Typically used to make transformations of Model that mean nothing | |
if there's no original animal. (Very likely an "impossible" case.) | |
model |> Form.givenOriginalAnimal form upsertAnimal |> noCmd | |
-} | |
givenOriginalAnimal : Form -> (Animal -> anything -> anything) | |
-> (anything -> anything) | |
givenOriginalAnimal form f = | |
case form.originalAnimal of | |
Nothing -> identity | |
Just animal -> f animal | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment