* [Caml-list] keeping parameter polymorphic
@ 2012-10-04 13:03 rixed
2012-10-04 13:13 ` Gabriel Scherer
0 siblings, 1 reply; 2+ messages in thread
From: rixed @ 2012-10-04 13:03 UTC (permalink / raw)
To: caml-list
Hello.
I can't find a way to keep f polymorphic in:
let test f = f 1, f true
that I'd like to return a int*bool from any function 'a->'a
I now this question regularly pops up, but I've tried many combinations
of "(type a)" and "'a." to no avail (ocaml 3.12.1 here).
(in real world, my function takes a generic "fold" function that I'd
like to use with various types).
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] keeping parameter polymorphic
2012-10-04 13:03 [Caml-list] keeping parameter polymorphic rixed
@ 2012-10-04 13:13 ` Gabriel Scherer
0 siblings, 0 replies; 2+ messages in thread
From: Gabriel Scherer @ 2012-10-04 13:13 UTC (permalink / raw)
To: rixed; +Cc: caml-list
Hi,
See the following FAQ item: "How to write a function with polymorphic
arguments?"
http://caml.inria.fr/resources/doc/faq/core.en.html#polymorphic-arguments
On Thu, Oct 4, 2012 at 3:03 PM, <rixed@happyleptic.org> wrote:
> Hello.
> I can't find a way to keep f polymorphic in:
>
> let test f = f 1, f true
>
> that I'd like to return a int*bool from any function 'a->'a
>
> I now this question regularly pops up, but I've tried many combinations
> of "(type a)" and "'a." to no avail (ocaml 3.12.1 here).
>
> (in real world, my function takes a generic "fold" function that I'd
> like to use with various types).
>
>
> --
> Caml-list mailing list. Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-04 13:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-04 13:03 [Caml-list] keeping parameter polymorphic rixed
2012-10-04 13:13 ` Gabriel Scherer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox