Version française
Home     About     Download     Resources     Contact us    
Browse thread
a role of explicit type coersion
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Keiko Nakata <keiko@k...>
Subject: Re: a role of explicit type coersion
I am sorry, my codes had typos.
I meant:

leafs.ml: 
let rec leafs = function
    `Node (a, b) -> (leafs a) @ (leafs b)
  | `Var _ as l -> [l]
  | others -> [others]
 
let leafs2 : ([> `Node of 'a * 'a ] as 'a) -> 'a list
  = (leafs2 :> ([> `Node of 'a * 'a ] as 'a) -> 'a list)
 
leafs.mli:
val leafs2 : ([> `Node of 'a * 'a ] as 'a) -> 'a list

Anyway, it seems impossible to hide `Var from the type of leafs2.

Keiko