Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Support GADT equations on non-local abstract types #7233
Original bug ID: 7233
Currently matching on a GADT can only introduce equations on locally abstract types. It would be useful if they could also add equations to other abstract types. For example:
type (_, _) eq = Refl : ('a, 'a) eq
module type S = sig
module F (M : S) = struct
Currently, the above is an error:
Error: This expression has type int but an expression was expected of type
Mostly such cases can be worked around by introducing a locally abstract type, but it is an unnecessary chore and can require code duplication.
Comment author: @lpw25
I remember Jacques mentioning that he would like to add support for this, but I couldn't find an actual Mantis issue for it, so I thought I would create one to track the issue.
I also considered having a go at adding support myself, by I wasn't entirely confident of what was required. Jacques, do you have a clear idea of what needs to be done?
Comment author: @garrigue
One has to update the environment to add equations deeply inside modules.