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: a role of explicit type coersion
Hello,

it is hard for me to understand why leafs.ml does not match with leafs.mli,
while the compilation of leafs.ml alone is successful.

leafs.ml: 
let rec leafs = function
    `Node (a, b) -> (leafs2 a) @ (leafs2 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

Best regards,
Keiko NAKATA