Skip to content

Instantly share code, notes, and snippets.

@bitwombat
Created July 19, 2019 09:46
Show Gist options
  • Save bitwombat/1ee476de55b3a45bed07302c1b821ca0 to your computer and use it in GitHub Desktop.
Save bitwombat/1ee476de55b3a45bed07302c1b821ca0 to your computer and use it in GitHub Desktop.
HPFFP Exercise page 475
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