Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* a role of explicit type coersion
@ 2005-11-29  8:32 Keiko Nakata
  2005-11-29 13:42 ` Keiko Nakata
  0 siblings, 1 reply; 2+ messages in thread
From: Keiko Nakata @ 2005-11-29  8:32 UTC (permalink / raw)
  To: caml-list

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


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

* Re: a role of explicit type coersion
  2005-11-29  8:32 a role of explicit type coersion Keiko Nakata
@ 2005-11-29 13:42 ` Keiko Nakata
  0 siblings, 0 replies; 2+ messages in thread
From: Keiko Nakata @ 2005-11-29 13:42 UTC (permalink / raw)
  To: caml-list

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


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

end of thread, other threads:[~2005-11-29 13:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-29  8:32 a role of explicit type coersion Keiko Nakata
2005-11-29 13:42 ` Keiko Nakata

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox