caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Strange interaction between recursive modules, GADT exhaustiveness checking and type-checking?
@ 2014-06-28 22:55 Nicolas Trangez
  2014-06-29 14:49 ` Grégoire Henry
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Trangez @ 2014-06-28 22:55 UTC (permalink / raw)
  To: Caml-list

All,

I was working on some code lately (admittedly, pushing some boundaries
w.r.t. recursive modules & GADTs), and got some confusing results.

All of this using OCaml 4.01.0, using `-w +A -warn-error +A`.

I tried to break it down to a small test-case, which you can find at
https://gist.github.com/NicolasT/3a6ef50d5607b744206b

The first case, implemented in module `W`, works as expected. No
warnings about a pattern match for `W (BB, _)` missing in `W.f`. Jay!

When doing something fairly similar in a couple of recursive modules
below, things become confusing. The compiler warns about a missing case
for `W (T.BB, _)` in `S.f`, as noted above it, whilst I think that
pattern shouldn't even type-check... I validated this by adding some
code at the end (in the `demo` function), trying to call `S.f` with a
`B.b S.w` argument, and this fails (as expected & desired). So why would
I be forced, or even allowed, to match on this case in `S.f` at all?

Nicolas


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-30 11:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-28 22:55 [Caml-list] Strange interaction between recursive modules, GADT exhaustiveness checking and type-checking? Nicolas Trangez
2014-06-29 14:49 ` Grégoire Henry
2014-06-30 11:07   ` Ben Millwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).