caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Sen Horak <sen.horak@gmail.com>
To: caml-list@yquem.inria.fr
Subject: [Caml-list] Polymorphism question
Date: Sun, 1 May 2011 14:07:46 -0400	[thread overview]
Message-ID: <BANLkTi=RYfNLxH+0VWZB1_UUsLKJAmjNuw@mail.gmail.com> (raw)

Hi,

I am trying to model a situation in which a caller calls a combination
of two functions:

- The first is a postprocessor that depends on the invocation g: a -> 'b
- The second is a higher order function: f: c x d x g -> 'b

One could leave the application of 'g' to the caller, making f: c x d -> a.
Then the caller would run:
let res_a = f inp_c inp_d in my_g res_a

But it would be nice to hide 'a' from the caller and have her call:

let res_b = f inp_c inp_d my_g

I guess I could use functors, and configure a generic f with a
particular type of g. Does that seem right, and if so could there be a
simper or easier way?

Sen

             reply	other threads:[~2011-05-01 18:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-01 18:07 Sen Horak [this message]
2011-05-01 19:32 ` Edgar Friendly

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='BANLkTi=RYfNLxH+0VWZB1_UUsLKJAmjNuw@mail.gmail.com' \
    --to=sen.horak@gmail.com \
    --cc=caml-list@yquem.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).