caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: David Allsopp <dra-news@metastack.com>
To: Serge Le Huitouze <serge.lehuitouze@gmail.com>,
	"caml-list@yquem.inria.fr" <caml-list@yquem.inria.fr>
Subject: RE: [Caml-list] Option functions (or lack thereof) + operator for composition
Date: Tue, 16 Nov 2010 11:49:24 +0000	[thread overview]
Message-ID: <E51C5B015DBD1348A1D85763337FB6D92C588946@Remus.metastack.local> (raw)
In-Reply-To: <AANLkTimX1JOva2Ebc3FuTGiZ5W3zXAvHtoE9RrkO8v6=@mail.gmail.com>

Serge Le Huitouze wrote:
> 1. Option type
> ****************
> It seems that there is no predefined function to test an "'a option" for
> being specifically "None" or "Some _". This seems to be confirmed by the
> very existence of:
> http://ocaml-lib.sourceforge.net/doc/Option.html
> which defines such functions ("is_none" and "is_some").
> I found it weird to be forced to use "match" expressions in my code for
> doing that, e.g.:
> *  let curSelectedRow = ref None in
> *  let updateButtonsStatus () =
> *      button_remove#misc#set_sensitive
> *              (match !curSelectedRow with None -> false | _ -> true)
> *  in
> *  ...
> 
> I could add the OCaml library mentioned above, but I don't know how to do
> it (and where to find it) and, since my code is supposed to go into some
> other code, I'd prefer avoiding adding yet another dependency to it...

ExtLib is well-worth having and it's very easy to install (just run ocaml install.ml in its source tree - findlib recommended but I've got a feeling that it can install without findlib as well). It's also very stable, feature-wise, so you're not really adding a tricky dependency. It's now hosted on Google Code at http://code.google.com/p/ocaml-extlib/downloads/list

You might also take a look at the batteries project (http://batteries.forge.ocamlcore.org) which I believe includes most if not all of ExtLib.



David


  reply	other threads:[~2010-11-16 11:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-16 11:27 Serge Le Huitouze
2010-11-16 11:49 ` David Allsopp [this message]
2010-11-16 14:23   ` [Caml-list] " Michael Ekstrand
2010-11-16 13:30 ` Jacques Garrigue
2010-11-16 13:52   ` Serge Le Huitouze
2010-11-16 14:19     ` dmitry grebeniuk
2010-11-16 14:26 ` Michael Ekstrand
2010-11-16 15:18   ` bluestorm
2010-11-16 15:26 ` bluestorm
     [not found] <1853021343.44703.1289906871683.JavaMail.root@zmbs4.inria.fr>
2010-11-16 11:43 ` Thomas Gazagnaire
2010-11-16 11:51   ` Gabriel Kerneis
2010-11-16 17:45     ` Martin Jambon

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=E51C5B015DBD1348A1D85763337FB6D92C588946@Remus.metastack.local \
    --to=dra-news@metastack.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=serge.lehuitouze@gmail.com \
    /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).