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/Compiler/ImportResolution.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Language/Fiddle/Compiler/ImportResolution.hs') diff --git a/src/Language/Fiddle/Compiler/ImportResolution.hs b/src/Language/Fiddle/Compiler/ImportResolution.hs index f3ddee0..6ecfc86 100644 --- a/src/Language/Fiddle/Compiler/ImportResolution.hs +++ b/src/Language/Fiddle/Compiler/ImportResolution.hs @@ -12,6 +12,7 @@ import qualified Codec.Compression.GZip as GZip import Control.Arrow (Arrow (second)) import Control.Monad (filterM, when) import Control.Monad.Identity (Identity) +import Control.Monad.State (put) import Control.Monad.Trans.Maybe (MaybeT (MaybeT, runMaybeT)) import Control.Monad.Writer.Lazy (MonadTrans (lift), MonadWriter (tell), WriterT (..), execWriterT) import Data.Aeson (eitherDecode, encode) @@ -31,7 +32,6 @@ import Options.Applicative import System.Directory import System.FilePath import Text.Printf (printf) -import Control.Monad.State (put) newtype Flags = Flags { importDirectories :: [FilePath] @@ -168,8 +168,8 @@ getImportResolutionState parseFile compileToChecked flags unit = do $ execWriterT $ walk doWalk unit () where - doWalk :: forall t'. (Walk t', Typeable t') => t' Identity Annot -> () -> WriterT ([Diagnostic], ResolvedImports) IO () - doWalk u () = + doWalk :: forall t'. (Walk t', Typeable t') => t' Identity Annot -> () -> WriterT ([Diagnostic], ResolvedImports) IO (WalkContinuation ()) + doWalk u () = do case () of () | Just @@ -184,6 +184,7 @@ getImportResolutionState parseFile compileToChecked flags unit = do ResolvedImports $ Map.singleton path (diagnostics, unitInterface) ) _ -> return () + return $ Continue () castTS :: ( Typeable t', -- cgit