Skip to content

Commit 653932e

Browse files
authored
Simplify import error handling logic (#711)
The first two cases of the `handler₀` function are just special cases of the last case
1 parent 65f5377 commit 653932e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

dhall/src/Dhall/Import.hs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -756,14 +756,15 @@ loadWith expr₀ = case expr₀ of
756756
:: (MonadCatch m)
757757
=> MissingImports
758758
-> StateT (Status m) m (Expr Src Import)
759-
handler₀ e@(MissingImports []) = throwM e
760-
handler₀ (MissingImports [e]) =
761-
throwMissingImport (Imported imports' e)
762-
handler₀ (MissingImports es) = throwM
763-
(MissingImports
764-
(fmap
765-
(\e -> (toException (Imported imports' e)))
766-
es))
759+
handler₀ (MissingImports es) =
760+
throwM
761+
(MissingImports
762+
(map
763+
(\e -> toException (Imported imports' e))
764+
es
765+
)
766+
)
767+
767768
handler₁
768769
:: (MonadCatch m)
769770
=> SomeException

0 commit comments

Comments
 (0)