Created
July 19, 2019 09:46
-
-
Save bitwombat/1ee476de55b3a45bed07302c1b821ca0 to your computer and use it in GitHub Desktop.
HPFFP Exercise page 475
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
module Page475 where | |
f :: Either a b -> [a] -> [a] | |
f c d = case c of | |
Left x -> d ++ [x] | |
_ -> d | |
lefts' :: [Either a b] -> [a] | |
lefts' e = foldr (f) [] e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment