Newsgroups: fa.caml
From: Jeremy Yallop <yal...@gmail.com>
Date: Mon, 28 Sep 2009 20:56:39 UTC
Local: Mon, Sep 28 2009 4:56 pm
Subject: [Caml-list] ANN: pa_polyrec: syntax for polymorphic recursion
I'm pleased to announce the initial release of pa_polyrec, a syntax extension
for polymorphic recursion in OCaml. https://forge.ocamlcore.org/projects/pa-polyrec/ There are several methods for encoding polymorphic-recursive functions in OCaml; type 'a perfect = Zero of 'a | Succ of ('a * 'a) perfect In standard OCaml such a function can be written as follows: let sump f = let sum_perfect = sump id Using pa_polyrec one can write the function in the following less obfuscated style: let rec sump : 'a. ('a -> int) -> 'a perfect -> int = let sum_perfect = sump id Note that the type variable 'a in the type of the function is quantified: this More complex usage is supported, including mutual recursion. A number of _______________________________________________ You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||
