With https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#extension-DuplicateRecordFields, you can do something like this:
data X = X { a :: A }
data Y = Y { a :: A }
f X{a = a} = a
g Y{a = a} = a
But I don't see something like this for constructors, like:
data X = A
data Y = A
f :: X -> ()
f A = ()
g :: Y -> ()
g A = ()
Couldn't a similar thing to the record syntax extension be done here? Where if it's ambiguous, it would be a compiler error, but if the type was annotated, it wouldn't be ambiguous and it should be legal?
I tried looking for existing proposals, but I couldn't find anything like this.