From c2f195a23bdb0d0dc876cc548d4c3157534082c6 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Thu, 10 Oct 2024 16:38:51 -0600 Subject: Add backend support and start implementing a C backend.o --- src/Language/Fiddle/Ast/Internal/SyntaxTree.hs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/Language/Fiddle/Ast/Internal/SyntaxTree.hs') diff --git a/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs b/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs index 1e9ace7..f627f15 100644 --- a/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs +++ b/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs @@ -222,12 +222,17 @@ instance Walk (Directed t stage) where walk fn (Directed directives subtree _) s = do - s' <- fn subtree s - walk fn subtree s' - - forM_ directives $ \d -> do - s' <- fn d s - walk fn d s' + forM_ directives $ \d -> + ( \case + Continue s' -> walk fn d s' + _ -> return () + ) + =<< fn d s + ( \case + Continue s' -> walk fn subtree s' + _ -> return () + ) + =<< fn subtree s -- | Apply a function to the underlying subtree in a 'Directed' type. mapDirected :: (t s f a -> t' s' f a) -> Directed t s f a -> Directed t' s' f a -- cgit