From 2d7bdeff56a34a40b7b2978173ddbba57d5d25d0 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 13 Mar 2017 14:59:02 -0400 Subject: [PATCH] Produce a better error when MiddleSnake fails to find a value. --- src/SES/Myers.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/SES/Myers.hs b/src/SES/Myers.hs index 406c5c718..6489d6f63 100644 --- a/src/SES/Myers.hs +++ b/src/SES/Myers.hs @@ -107,7 +107,11 @@ decompose myers = let ?callStack = popCallStack callStack in case myers of else return (zipWith These (toList as) (toList bs)) - MiddleSnake graph -> fmap (fromMaybe (error "bleah")) (for [0..maxD] (searchUpToD graph . EditDistance)) + MiddleSnake graph -> do + result <- for [0..maxD] (searchUpToD graph . EditDistance) + case result of + Just result -> return result + Nothing -> error "MiddleSnake must always find a value." SearchUpToD graph (EditDistance d) -> (<|>) <$> for [negate d, negate d + 2 .. d] (searchAlongK graph (EditDistance d) Forward . Diagonal)