From: Damien Doligez <Damien.Doligez@inria.fr>
To: "Jeffrey J. Cook" <jjcook@uiuc.edu>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] polymorphic type constructor deconstructor
Date: Tue, 10 Jun 2003 17:28:57 +0200 [thread overview]
Message-ID: <4069A4E9-9B58-11D7-AB87-0003930FCE12@inria.fr> (raw)
In-Reply-To: <20030606213021.GE27432@crhc.uiuc.edu>
On Friday, June 6, 2003, at 11:30 PM, Jeffrey J. Cook wrote:
> let request = REQ_do_this 5 in
> let reply = Socket.client "mysocket" request in
> let success =
> match reply with
> | REPLY_do_this x -> x
> | _ -> failwith "this case shouldn't happen and is annoying"
You can use patterns in the left-hand part of a let:
let request = REQ_do_this 5 in
let reply = Socket.client "mysocket" request in
let REPLY_do_this success = reply in
... success ...
The compiler will complain about a non-exhaustive pattern matching,
but that's only fair.
-- Damien
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
prev parent reply other threads:[~2003-06-10 15:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-06 21:30 Jeffrey J. Cook
2003-06-06 22:37 ` Jeffrey J. Cook
2003-06-07 0:09 ` John Max Skaller
2003-06-07 8:22 ` Marcin 'Qrczak' Kowalczyk
2003-06-10 15:28 ` Damien Doligez [this message]
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=4069A4E9-9B58-11D7-AB87-0003930FCE12@inria.fr \
--to=damien.doligez@inria.fr \
--cc=caml-list@inria.fr \
--cc=jjcook@uiuc.edu \
/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).