Last active
September 26, 2017 09:27
-
-
Save alexbiehl/9a74cff97e549d8ba549305792284549 to your computer and use it in GitHub Desktop.
This file contains 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
clunky env var1 var2 | ok1 && ok2 = val1 + val2 | |
| otherwise = var1 + var2 | |
where | |
m1 = lookup env var1 | |
m2 = lookup env var2 | |
ok1 = maybeToBool m1 | |
ok2 = maybeToBool m2 | |
val1 = expectJust m1 | |
val2 = expectJust m2 | |
clunky env var1 var2 | |
| Just val1 <- lookup env var1 | |
, Just val2 <- lookup env var2 | |
= val1 + val2 | |
| otherwise = var1 + var2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment