Commit da312a99 authored by Pietro Abate's avatar Pietro Abate
Browse files

Add Var.Set printer

parent 6b98ddda
......@@ -30,20 +30,31 @@ let equal v1 v2 = (compare v1 v2) = 0
let ch_variance variance (`Var t) =
match t.variance,variance with
|`None,_ -> `Var { t with variance = variance }
|`Both ,_ -> `Var t
|`None,_ -> t.variance <- variance
|`Both ,_ -> ()
|`ContraVariant,`ContraVariant
|`Covariant,`Covariant -> `Var t
|_,_ -> `Var { t with variance = `Both }
|`Covariant,`Covariant -> ()
|_,_ -> t.variance <- `Both
let set_variance variance (`Var t) = t.variance <- variance
let variance (`Var t) = t.variance
let id (`Var t) = t.id
let is_fresh (`Var t) = t.fresh
module Set = Set.Make(
struct
type t = var
let compare = compare
end)
module Set = struct
include Set.Make( struct type t = var let compare = compare end)
let aux_print sep printer ppf s =
let rec aux ppf = function
|[] -> ()
|[h] -> printer ppf h
|h::l -> Format.fprintf ppf "%a %s %a" printer h sep aux l
in
aux ppf (elements s)
let dump ppf s = aux_print ";" dump ppf s
let print ppf s = aux_print ";" print ppf
end
module Make (X : Custom.T) = struct
type t = X.t pairvar
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment