caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* re[Caml-list] cursive type definition camllight
@ 2011-01-19 18:10 sieira
  2011-01-20  9:32 ` [Caml-list] Re: recursive " Damien Doligez
  0 siblings, 1 reply; 2+ messages in thread
From: sieira @ 2011-01-19 18:10 UTC (permalink / raw)
  To: caml-list


I'm implementing a graphical interface in camllight on which there are forms.
I've defined a form as

type form == textbox list * (form,customer list -> customer list);;

This form displays some textboxes (using graphics library) on which the user
types the necessary data, after that, it is parsed and tailed to the
returned customer list. It is necessary that the function that does this
takes the form as a parameter. ¿Is this possible?

Otherwise, i could do:

type form == textbox list * (field_values list,customer list -> customer
list);;

but I would like to avoid it in order to keep a clean code.

Thanks in advance for your replies.


-- 
View this message in context: http://old.nabble.com/recursive-type-definition-camllight-tp30712448p30712448.html
Sent from the Caml Discuss mailing list archive at Nabble.com.



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

* [Caml-list] Re: recursive type definition camllight
  2011-01-19 18:10 re[Caml-list] cursive type definition camllight sieira
@ 2011-01-20  9:32 ` Damien Doligez
  0 siblings, 0 replies; 2+ messages in thread
From: Damien Doligez @ 2011-01-20  9:32 UTC (permalink / raw)
  To: caml users


On 2011-01-19, at 19:10, sieira wrote:

> type form == textbox list * (form,customer list -> customer list);;
> 
> This form displays some textboxes (using graphics library) on which the user
> types the necessary data, after that, it is parsed and tailed to the
> returned customer list. It is necessary that the function that does this
> takes the form as a parameter. ¿Is this possible?

You cannot define a recursive type abbreviation in Caml Light.  But you
can define a recursive concrete type:

type form = Form of textbox list * (form -> customer list -> customer list);;

This will make your code a bit more cumbersome (you'll have to add the
Form constructor in many places), but it should work.

-- Damien



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

end of thread, other threads:[~2011-01-20  9:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-19 18:10 re[Caml-list] cursive type definition camllight sieira
2011-01-20  9:32 ` [Caml-list] Re: recursive " Damien Doligez

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