Oug: Example 6
Code

type trec = {
label1 : string ;
mutable label2 : int ;
label3 : string
}

;;

let x = { label1 = "x" ; label2 = 15 ; label3 = "foo"};;

let f = function
{ label1 = "y" } -> 1
| { label1 = s ; label2 = 3 } -> 3
| { label1 = s } -> String.length s
;;

let g = function
{ label1 = "y" } -> 1
| { label1 = s ; label2 = 3 } -> 3
| { label1 = s } -> String.length s
;;

let my_rec t = { label1 = "coucou" ; label2 = t ; label3 = "coucou"};;
let my_rec2 = let x = my_rec 3 in { x with label1 = "bar" ; label2 = x.label2 + 1} ;;

module M =
struct
type tvar = Zero | Un of int | Deux of int | Trois of float
end;;
open M;;
let f = function
Un n when n > 0 -> n + 1
| Zero -> 0
| Un n -> n - 1
| Deux n -> n
| Trois f -> int_of_float f
;;

let x = Un (f (Trois 4.4));;

type foo = Var of tvar | Rec of trec | String of string;;

let x = Rec { label1 = "x"; label2 = 3 ; label3 = "coucou"};;

type t = { field : int };;
let f x = if x.field = 1 then () else ();;
Oug graph

Graph

Debug graph

Debug graph