caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Nicolas Braud-Santoni <nicolas@braud-santoni.eu>
To: Gabriel Scherer <gabriel.scherer@gmail.com>
Cc: David.Teller@ens-lyon.org,
	Yitzhak Mandelbaum <yitzhakm@cs.princeton.edu>,
	 OCaml mailing list <caml-list@inria.fr>
Subject: Re: [Caml-list] optional functions in modules
Date: Fri, 18 May 2012 22:05:29 +0200	[thread overview]
Message-ID: <CA+qp_4o9HF-2DcD+VtY2PVrhWqV9GO2J2P7iQwaHswSzmwtfqQ@mail.gmail.com> (raw)
In-Reply-To: <CAPFanBFm-0aSWtVS8BX2AuFjEFuxEweWQVp9bp7f0pXTE+_P-A@mail.gmail.com>

It's quite different : the exception will be thrown whenever the
function is applied.
However, I can't find how to fix this without loosing polymorphism right now.

2012/5/18 Gabriel Scherer <gabriel.scherer@gmail.com>:
> You can regain that polymorphism at a moderate efficiency cost by eta-expanding:
>
>   let mmap2 f = match mmap with | None -> failwith "Nope" | Some x -> x f;;
>   val mmap2 : ('a -> 'b) -> 'a list -> 'b list = <fun>

      reply	other threads:[~2012-05-18 20:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-10 12:22 Yitzhak Mandelbaum
2012-05-10 14:13 ` "Markus W. Weißmann"
2012-05-10 14:53 ` Fabrice Le Fessant
2012-05-10 14:59   ` David Rajchenbach-Teller
2012-05-10 18:44 ` Goswin von Brederlow
2012-05-11  0:55   ` Yaron Minsky
2012-05-17 17:43     ` Yitzhak Mandelbaum
2012-05-18 15:24       ` David Rajchenbach-Teller
2012-05-18 16:00         ` Gabriel Scherer
2012-05-18 20:05           ` Nicolas Braud-Santoni [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=CA+qp_4o9HF-2DcD+VtY2PVrhWqV9GO2J2P7iQwaHswSzmwtfqQ@mail.gmail.com \
    --to=nicolas@braud-santoni.eu \
    --cc=David.Teller@ens-lyon.org \
    --cc=caml-list@inria.fr \
    --cc=gabriel.scherer@gmail.com \
    --cc=yitzhakm@cs.princeton.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).