From d65a65030513b45c3d3b182f74558935760fbdc5 Mon Sep 17 00:00:00 2001 From: Gabriel Gonzalez Date: Sat, 24 Nov 2018 21:25:28 -0800 Subject: [PATCH] Simplify import error handling logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The first two cases of the `handler₀` function are just special cases of the last case --- dhall/src/Dhall/Import.hs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/dhall/src/Dhall/Import.hs b/dhall/src/Dhall/Import.hs index 1977006b4..0c2f114ea 100644 --- a/dhall/src/Dhall/Import.hs +++ b/dhall/src/Dhall/Import.hs @@ -745,14 +745,15 @@ loadWith expr₀ = case expr₀ of :: (MonadCatch m) => MissingImports -> StateT (Status m) m (Expr Src Import) - handler₀ e@(MissingImports []) = throwM e - handler₀ (MissingImports [e]) = - throwMissingImport (Imported imports' e) - handler₀ (MissingImports es) = throwM - (MissingImports - (fmap - (\e -> (toException (Imported imports' e))) - es)) + handler₀ (MissingImports es) = + throwM + (MissingImports + (map + (\e -> toException (Imported imports' e)) + es + ) + ) + handler₁ :: (MonadCatch m) => SomeException