-
Notifications
You must be signed in to change notification settings - Fork 63
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
Allow type synonyms inside other type synonyms #1986
Conversation
Instantiate the body of a type synonym declaration with the existing type synonym map before adding it to the map, so that the map never contains any uninstantiated type synonyms.
src/SAWScript/MGU.hs
Outdated
@@ -382,10 +387,13 @@ instance Instantiate Type where | |||
TySkolemVar _ _ -> ty | |||
LType pos ty' -> LType pos (instantiate nts ty') | |||
|
|||
instantiateType :: Instantiate t => Map Name Type -> t -> t | |||
instantiateType tenv = instantiate (M.assocs tenv) |
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.
This does almost the exact same thing as the instantiate
method of the Instantiate
class, except that this function uses a Map Name Type
instead of [(Name, Type)]
. I think using a Map
makes more sense here—any objection to simply changing the type signature of instantiate
to use a Map
instead?
Either way, it would be worth leaving a comment saying precisely what we are instantiating. (Particularly, we're instantiating typedefs.)
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.
Ok, I've changed instantiate
to use Map
. It seems like it's not only used with typedefs, so I wrote a more general description.
Instantiate the body of a type synonym declaration with the existing type synonym map before adding it to the map, so that the map never contains any uninstantiated type synonyms.
Fixes #1985.