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
Question on Variant Types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-06-28 (23:44)
From: Seth J. Fogarty <sfogarty@g...>
Subject: Re: [Caml-list] Question on Variant Types
Followup question:
Given I have:
type foo = [`A | `B of int | `C of char]
type bar = [`B of int | `C  of char| `D]

and a function
let f (x : foo) : bar =
match x with
    `A -> `D
   |`B _
   |`C _ -> (x : bar)

Is there any way to properly coerce this using the restricted variant
information of x? Or do I have to duplicate code and reconstruct x?

Seth Fogarty             sfogarty@[||livejournal]
Neep-neep at large    AIM: Sorrath
"I know there are people in this world who do not love their fellow
human beings - and I hate people like that" --Tom Lehrer.