From: Misha Aizatulin <avatar@hot.ee>
To: caml-list@inria.fr
Subject: [Caml-list] Pattern match fall-through for GADTs
Date: Mon, 23 Dec 2013 21:25:06 +0200 [thread overview]
Message-ID: <52B88E12.20002@hot.ee> (raw)
hi all,
I decided to give GADTs a go and realized that I don't know how to
make pattern matches fall through in a familiar fashion. The code [1]
below gets accepted but [2] does not. Is there anything I can do to
avoid spelling out the same case several times?
Best,
Misha
[1]
type 'a t =
| I1 : int t
| I2 : int t
| B1 : bool t
| B2 : bool t
let f (type a) (t : a t) =
match t with
| I1 -> 0
| I2 -> 0
| B1 -> 1
| B2 -> 1
[2]
let f (type a) (t : a t) =
match t with
| I1
| I2 -> 0
| B1
| B2 -> 1
reply other threads:[~2013-12-23 19:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52B88E12.20002@hot.ee \
--to=avatar@hot.ee \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox