Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Troublesome nodes
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-07-12 (18:59)
From: Jacques Carette <carette@m...>
Subject: Re: [Caml-list] Troublesome nodes
Wolfgang Lux wrote:
> This problem is apparently easy to solve. Just don't expect an exact 
> super_node_t list argument for the bold function. Instead use
>   val bold : [< super_node_t] list -> nonlink_node_t
> in the signature and
>   let bold seq = `Bold (seq :> super_node_t list)
> in the body of the Node module's definition.
Indeed, works like a charm.  You don't even need the coercion in the 
body of 'bold' for it to work.

This will hopefully allow me to remove some coercions from my own code, 
and use subtype annotations in the types.