8000 Fix `{modify,state}TCLensM` and `%==` and `%%=` (lost state effects) by andreasabel · Pull Request #7474 · agda/agda · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix {modify,state}TCLensM and %== and %%= (lost state effects) #7474

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

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

andreasabel
Copy link
Member

Background: #7470 (comment)

8000
@andreasabel andreasabel added this to the 2.8.0 milestone Sep 6, 2024
@andreasabel andreasabel added the type: task Concerning the development of Agda (not in changelog) label Sep 6, 2024
@andreasabel andreasabel self-assigned this Sep 6, 2024
Copy link
Member Author
@andreasabel andreasabel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jespercockx Was the following code exploiting a buggy implementation of stateTCLensM?

instance MonadStConcreteNames TCM where
runStConcreteNames m = stateTCLensM stConcreteNames $ runStateT m

I suppose not, because it is only used in the following two methods which are only used in AbstractToConcrete:

useConcreteNames :: m ConcreteNames
useConcreteNames = runStConcreteNames get
modifyConcreteNames :: (ConcreteNames -> ConcreteNames) -> m ()
modifyConcreteNames = runStConcreteNames . modify

@@ -786,7 +786,7 @@ solveAwakeConstraints' = solveSomeAwakeConstraints (const True)
{-# SPECIALIZE freezeMetas :: LocalMetaStore -> TCM (Set MetaId) #-}
-- | Freeze the given meta-variables (but only if they are open) and
-- return those that were not already frozen.
freezeMetas :: forall m. MonadTCState m => LocalMetaStore -> m (Set MetaId)
freezeMetas :: forall m. (MonadTCState m, ReadTCState m) => LocalMetaStore -> m (Set MetaId)
freezeMetas ms =
execWriterT $
modifyTCLensM stOpenMetaStore $
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This use of modifyTCLensM was fine even before the fix because the computation did not modify TCState.

@andreasabel andreasabel merged commit 8e19de3 into master Sep 6, 2024
40 checks passed
@andreasabel andreasabel deleted the modifyTCLensM branch September 12, 2024 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task Concerning the development of Agda (not in changelog)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0