Skip to content
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

GADT constructor disambiguation in pattern matching #6852

Closed
vicuna opened this issue Apr 28, 2015 · 1 comment
Closed

GADT constructor disambiguation in pattern matching #6852

vicuna opened this issue Apr 28, 2015 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Apr 28, 2015

Original bug ID: 6852
Reporter: @Drup
Status: closed (set by @alainfrisch on 2015-04-28T16:51:46Z)
Resolution: duplicate
Priority: normal
Severity: minor
Version: 4.02.1
Category: typing
Duplicate of: #6023

Bug description

At the moment, the compiler refuses to disambiguate GADT by telling you explicitly "The GADT constructor must be qualified in this pattern".

It puzzles me a bit, because it means the typechecker actually already found it was a GADT (hence found the type ..) and then refuses to disambiguate.

Also, with ADTs, you can disambiguate one branch of a patter matching and the other branches will not be considered ambiguous. There is no such thing for GADT and the compiler will still refuse to typechecker if only one branch is disambiguated.

For example, I would like to be able to at least write this:

module M = struct
type _ t =
| I : int t
| S : string t
end

let f : type x . x M.t -> x
= function
| M.I -> 3
| S -> "bla"

@vicuna
Copy link
Author

vicuna commented Apr 28, 2015

Comment author: @yallop

See #6023 for some discussion on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant