caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] exhaustiveness checking within a submatch
@ 2013-10-10  8:00 Martin DeMello
  2013-10-10  8:07 ` David Allsopp
  0 siblings, 1 reply; 4+ messages in thread
From: Martin DeMello @ 2013-10-10  8:00 UTC (permalink / raw)
  To: OCaml List

Just curious as to why the compiler can't handle this, since in theory
everything is statically deducible:

# type test = A | B | C | D;;
type test = A | B | C | D

# let f = A;;
val f : test = A

# match f with A -> 1 | B -> 2 | C | D -> ( match f with C -> 3 | D -> 4);;
Characters 40-71:
                                                               Warning
8: this pattern-matching is not exhaustive.
                                                       Here is an
example of a value that is not matched:
(A|B)
Characters 40-71:
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(A|B)
- : int = 1

martin

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

end of thread, other threads:[~2013-10-10 17:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-10  8:00 [Caml-list] exhaustiveness checking within a submatch Martin DeMello
2013-10-10  8:07 ` David Allsopp
2013-10-10  8:09   ` David House
2013-10-10 17:32     ` Martin DeMello

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).