-
Notifications
You must be signed in to change notification settings - Fork 339
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
fix recRecursive when record isn't recursive #7042
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you are after here, but I can't see how this makes sense.
If you want to query recRecursive
before the mutuality computation has run, maybe you want to change the type to Defn -> Maybe Bool
.
Currently, the invariant is that recRecursive
is never queried before it has been set to Just _
.
@@ -2960,7 +2960,7 @@ instance Pretty ProjLams where | |||
|
|||
-- | Is the record type recursive? | |||
recRecursive :: Defn -> Bool | |||
recRecursive (Record { recMutual = Just qs }) = not $ null qs | |||
recRecursive (Record { recMutual = mqs }) = any (not . null) mqs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, the semantics of recMutual = Nothing
is that nothing is known about mutualilty yet.
If you want not mutual you have to make sure this gets set to Just []
.
Are you saying that all record definitions should have Because the bug from agda2hs I'm refering to comes from a record definition compiled with the backend. We call |
(I think you meant to write |
Thank you for the clarification. So I guess there is still an issue with the record from agda/agda2hs#257 never getting |
@flupe Maybe this PR fixes your problem in agda2hs: |
Thank you for the heads up! |
A bug in agda/agda2hs#257 is caused by it relying on
TypeChecking/Monad/Base:recRecursive
which may fail whenrecMutual
is set toNothing
.