diff --git a/package-lock.json b/package-lock.json index 06c9d33..8e86db5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -239,7 +239,6 @@ "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", - "fsevents": "~2.3.2", "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", @@ -1069,9 +1068,6 @@ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", "dev": true, - "dependencies": { - "graceful-fs": "^4.1.6" - }, "optionalDependencies": { "graceful-fs": "^4.1.6" } diff --git a/src/Maybe/Extra.elm b/src/Maybe/Extra.elm index cf4cd67..33bf7e7 100644 --- a/src/Maybe/Extra.elm +++ b/src/Maybe/Extra.elm @@ -447,8 +447,23 @@ If there are any `Nothing`s, the whole function fails and returns `Nothing`. -} combine : List (Maybe a) -> Maybe (List a) -combine = - List.foldr (map2 (::)) (Just []) +combine list = + combineHelp list [] + + +combineHelp : List (Maybe a) -> List a -> Maybe (List a) +combineHelp list acc = + case list of + head :: tail -> + case head of + Just a -> + combineHelp tail (a :: acc) + + Nothing -> + Nothing + + [] -> + Just (List.reverse acc) {-| Like [`combine`](#combine), but map a function over each element of the list first.