Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Jeremy Yallop <jeremy.yallop@e...>
Subject: Re: [Caml-list] Troublesome nodes
Dario Teixeira wrote:
>     and convert_super_node node = match node with
>         | #nonlink_node_t   -> (convert_nonlink_node node :> super_node_t)
>         | #link_node_t      -> (convert_link_node node :> super_node_t)

You need to rebind the matched value within the pattern in order to 
refine the type on the rhs:

and convert_super_node node = match node with
| #nonlink_node_t as node -> (convert_nonlink_node node :> super_node_t)
| #link_node_t    as node -> (convert_link_node node :> super_node_t)

Jeremy.