@@ -9,7 +9,7 @@ import Control.Applicative
99import Control.Monad (foldM , unless , when )
1010import Control.Monad.IO.Class (MonadIO , liftIO )
1111import Data.Bifunctor
12- import Data.Either (fromRight , rights )
12+ import Data.Either (fromRight , isRight , rights )
1313import Data.Functor ((<&>) )
1414import Data.List (foldl' )
1515import Data.Maybe (fromJust , fromMaybe )
@@ -182,10 +182,12 @@ define hidden ctx qualifiedXObj =
182182 defineInTypeEnv = pure . fromRight ctx . (insertTypeBinder ctx qpath)
183183 defineInGlobalEnv :: Binder -> IO Context
184184 defineInGlobalEnv newBinder =
185- when (projectEchoC (contextProj ctx)) (putStrLn (toC All (Binder emptyMeta annXObj)))
185+ when (projectEchoC (contextProj ctx) && canBeEmitted annXObj ) (putStrLn (toC All (Binder emptyMeta annXObj)))
186186 >> case (lookupBinderInGlobalEnv ctx qpath) of
187187 Left _ -> pure (fromRight ctx (insertInGlobalEnv ctx qpath newBinder))
188188 Right oldBinder -> redefineExistingBinder oldBinder newBinder
189+ canBeEmitted :: XObj -> Bool
190+ canBeEmitted x = isRight (checkForUnresolvedSymbols x)
189191 redefineExistingBinder :: Binder -> Binder -> IO Context
190192 redefineExistingBinder old@ (Binder meta _) (Binder _ x) =
191193 do
0 commit comments