Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force evaluation of warnings and errors in catchCYIO #90

Merged
merged 1 commit into from
Mar 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/Curry/LanguageServer/Compiler.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import qualified Curry.Frontend.Modules as CMD
import qualified Curry.Frontend.Transformations as CT
import qualified Text.PrettyPrint as PP

import Control.Exception (evaluate)
import Control.Monad (join, when)
import Control.Monad.Trans (lift)
import Control.Monad.Trans.Reader (ReaderT (..))
Expand Down Expand Up @@ -88,10 +89,12 @@ runCMT cm aux = flip runReaderT aux . flip runStateT mempty . runMaybeT $ cm
catchCYIO :: MonadIO m => CYIO a -> CMT m (Maybe a)
catchCYIO cyio = liftIO (runCYIO cyio) >>= \case
Left es -> do
modify $ \s -> s { errors = s.errors ++ es }
es' <- mapM (liftIO . evaluate) es
modify $ \s -> s { errors = s.errors ++ es' }
return Nothing
Right (x, ws) -> do
modify $ \s -> s { warnings = s.warnings ++ ws }
ws' <- mapM (liftIO . evaluate) ws
modify $ \s -> s { warnings = s.warnings ++ ws' }
return $ Just x

liftToCM :: Monad m => m a -> CMT m a
Expand Down