You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4907 Reporter:@mmottl Assigned to:@garrigue Status: assigned (set by @garrigue on 2012-06-01T07:32:44Z) Resolution: open Priority: normal Severity: feature Version: 3.11.1 Category: typing Monitored by: "Julien Signoles" @hcarty@mmottl
Bug description
The following would seem like a perfectly legitimate thing to do:
type ('a, 'b) t = { a : 'a; b : 'b }
type ('a, 'b) u = ('a, 'b option) t = { a : 'a; b : 'b option }
Unfortunately, the compiler fails with:
File "foo.ml", line 3, characters 5-63:
Error: The variant or record definition does not match that of type
('a, 'b option) t
This does not quite seem correct.
This restriction makes it impossible to e.g. repeat a type definition in a more specialized way such that the preprocessor can exploit the extra syntactic representation to generate code more flexibly from the type definition.
The text was updated successfully, but these errors were encountered:
The problem is that a record type declaration is generative, so your second record type is
not an instance of the first. Can this be changed without major changes to the typechecker?
I don't know.
This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.
Actually, I strongly prefer not changing the current behaviour.
If two nominal types are equal, their parameters should be equal too.
This has implications on the ability to unify their type constructors (generativity in Haskell parlance)..
Original bug ID: 4907
Reporter: @mmottl
Assigned to: @garrigue
Status: assigned (set by @garrigue on 2012-06-01T07:32:44Z)
Resolution: open
Priority: normal
Severity: feature
Version: 3.11.1
Category: typing
Monitored by: "Julien Signoles" @hcarty @mmottl
Bug description
The following would seem like a perfectly legitimate thing to do:
type ('a, 'b) t = { a : 'a; b : 'b }
type ('a, 'b) u = ('a, 'b option) t = { a : 'a; b : 'b option }
Unfortunately, the compiler fails with:
File "foo.ml", line 3, characters 5-63:
Error: The variant or record definition does not match that of type
('a, 'b option) t
This does not quite seem correct.
This restriction makes it impossible to e.g. repeat a type definition in a more specialized way such that the preprocessor can exploit the extra syntactic representation to generate code more flexibly from the type definition.
The text was updated successfully, but these errors were encountered: