on master help sign in
Merge pull request #790 from michaelbjames/master

Fix: filterMap was missing a parameter

commit367d8664d6d971075cbca0bedb0fa2d1587d259a authorEvan Czaplicki <info@elm-lang.org> dateThu 18 Sep 2014, 22:18 (12 years ago) parentafff54cdef3235
1 file changed+4−4
libraries/List.elm+4−4
libraries/List.elm+4−4
@@ -138,11 +138,11 @@ the successes.
138138 filterMap toInt ["3", "4.0", "5", "hats"] == [3,5]
139139-}
140140filterMap : (a -> Maybe b) -> [a] -> [b]
141−filterMap xs = Native.List.foldr maybeCons [] xs
141+filterMap f xs = foldr (maybeCons f) [] xs
142142
143−maybeCons : Maybe a -> [a] -> [a]
144−maybeCons mx xs =
145− case mx of
143+maybeCons : (a -> Maybe b) -> a -> [b] -> [b]
144+maybeCons f mx xs =
145+ case f mx of
146146 Just x -> x :: xs
147147 Nothing -> xs
148148