caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
To: OCaml List <caml-list@inria.fr>
Subject: [Caml-list] Suboptimal pattern matching specification
Date: Thu, 7 Apr 2016 15:36:28 +0200	[thread overview]
Message-ID: <91DFDE4DE82E4A8B983A7822E695BBA4@erratique.ch> (raw)

Hello,   

Something I run quite often is the following pattern matching  

match v with
| None | Some c when sat c -> expr
| Some …  

which doesn't compile and forces me to write  

match v with  
| None -> expr  
| Some c when sat c -> expr
| Some …  

and leads to code duplication or the introduction of a definition to avoid it.  

Am I missing a syntax bit ?  

Best,

Daniel



             reply	other threads:[~2016-04-07 13:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-07 13:36 Daniel Bünzli [this message]
2016-04-07 16:36 ` Gabriel Scherer

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=91DFDE4DE82E4A8B983A7822E695BBA4@erratique.ch \
    --to=daniel.buenzli@erratique.ch \
    --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;
as well as URLs for NNTP newsgroup(s).