summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Kerneis2014-05-15 16:16:04 +0100
committerGabriel Kerneis2014-05-15 16:16:04 +0100
commit66f38d819c70f058fffe92fcbb39e7528616187a (patch)
tree84c6e39324544d0cea4287bb8ee60d4ea80f27ad
parentd79ca6c7b9122ec7662d1a398d770d31e06dda60 (diff)
Refactor doc_type_union
-rw-r--r--src/pretty_print.ml9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/pretty_print.ml b/src/pretty_print.ml
index fccc0d08..fef87be1 100644
--- a/src/pretty_print.ml
+++ b/src/pretty_print.ml
@@ -1189,6 +1189,10 @@ let rec doc_range (BF_aux(r,_)) = match r with
| BF_range(i1,i2) -> doc_op dotdot (doc_int i1) (doc_int i2)
| BF_concat(ir1,ir2) -> (doc_range ir1) ^^ comma ^^ (doc_range ir2)
+let doc_type_union (Tu_aux(typ_u,_)) = match typ_u with
+ | Tu_ty_id(typ,id) -> doc_typ typ ^/^ doc_id id ^^ semi
+ | Tu_id id -> doc_id id ^^ semi
+
let doc_typdef (TD_aux(td,_)) = match td with
| TD_abbrev(id,nm,typschm) ->
string "typedef" ^/^
@@ -1202,10 +1206,7 @@ let doc_typdef (TD_aux(td,_)) = match td with
(doc_id id ^^ doc_namescm nm)
(const ^/^ doc_typquant typq ^^ braces fs_doc)
| TD_variant(id,nm,typq,ar,_) ->
- let a_pp (Tu_aux(typ_u,_)) = match typ_u with
- | Tu_ty_id(typ,id) -> doc_typ typ ^/^ doc_id id ^^ semi
- | Tu_id id -> doc_id id ^^ semi in
- let ar_doc = separate_map (break 1) a_pp ar in
+ let ar_doc = separate_map (break 1) doc_type_union ar in
let const = string "const" ^/^ string "union" in
string "typedef" ^/^
doc_op equals