caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Polymorphism question
@ 2011-05-01 18:07 Sen Horak
  2011-05-01 19:32 ` Edgar Friendly
  0 siblings, 1 reply; 2+ messages in thread
From: Sen Horak @ 2011-05-01 18:07 UTC (permalink / raw)
  To: caml-list

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-01 19:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-01 18:07 [Caml-list] Polymorphism question Sen Horak
2011-05-01 19:32 ` Edgar Friendly

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).