Skip to content

Commit

Permalink
fourmolu
Browse files Browse the repository at this point in the history
  • Loading branch information
jberthold committed Jul 11, 2023
1 parent 3b8806a commit 455a6a8
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions library/Booster/Pattern/Rewrite.hs
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ performRewrite doTracing def mLlvmLibrary mbMaxDepth cutLabels terminalLabels pa
RewriteBranch p nexts -> do
p' <- simplifyP p
let simplifyP3rd (a, b, c) =
maybe Nothing (Just . (a, b,)) <$> simplifyP c
maybe Nothing (Just . (a,b,)) <$> simplifyP c
nexts' <- catMaybes <$> mapM simplifyP3rd (toList nexts)
pure $ case (p', nexts') of
(Nothing, _) -> RewriteStuck pat
Expand Down Expand Up @@ -514,7 +514,8 @@ performRewrite doTracing def mLlvmLibrary mbMaxDepth cutLabels terminalLabels pa
pretty $ "Reached maximum depth of " <> maybe "?" showCounter mbMaxDepth
logRewrite $ pack $ renderDefault $ showPattern title pat'
(if wasSimplified then pure else simplifyResult) $ RewriteFinished Nothing Nothing pat'
else runRewriteT doTracing def mLlvmLibrary (rewriteStep cutLabels terminalLabels pat') >>= \case
else
runRewriteT doTracing def mLlvmLibrary (rewriteStep cutLabels terminalLabels pat') >>= \case
Right (RewriteFinished mlbl uniqueId single) -> do
whenJust mlbl $ \lbl ->
rewriteTrace $ RewriteSingleStep lbl uniqueId pat' single
Expand Down Expand Up @@ -579,11 +580,11 @@ performRewrite doTracing def mLlvmLibrary mbMaxDepth cutLabels terminalLabels pa
then logRewrite msg >> pure (RewriteAborted pat')
else withSimplified pat' msg (pure . RewriteAborted)
where
withSimplified p msg cont = do
simplifyP p >>= \case
Nothing -> do
logRewrite "Rewrite stuck after simplification."
pure $ RewriteStuck p
Just simplifiedPat -> do
logRewrite msg
cont simplifiedPat
withSimplified p msg cont = do
simplifyP p >>= \case
Nothing -> do
logRewrite "Rewrite stuck after simplification."
pure $ RewriteStuck p
Just simplifiedPat -> do
logRewrite msg
cont simplifiedPat

0 comments on commit 455a6a8

Please sign in to comment.