| `Type _ -> "Type"
| `NType s -> "Type[" ^ s ^ "]"
+let map_space f l =
+ HExtlib.list_concat
+ ~sep:[space] (List.map (fun x -> [f x]) l)
+;;
+
let pp_ast0 t k =
let rec aux =
function
function
Ast.Pattern (head, href, vars) ->
hvbox true true (ident_w_href href head ::
- List.flatten (List.map (fun x -> [break;x]) (List.map aux_var vars)))
+ List.flatten (List.map (fun x -> [break;x]) (map_space aux_var vars)))
| Ast.Wildcard -> builtin_symbol "_"
in
let patterns' =
match rec_kind with `Inductive -> "rec" | `CoInductive -> "corec"
in
let mk_fun (args, (name,ty), body, rec_param) =
- List.map aux_var args ,k name, HExtlib.map_option k ty, k body,
- fst (List.nth args rec_param)
+ List.flatten (List.map (fun x -> [aux_var x; space]) args),
+ k name, HExtlib.map_option k ty, k body, fst (List.nth args rec_param)
in
let mk_funs = List.map mk_fun in
let fst_fun, tl_funs =
space;
keyword rec_op;
space;
- name] @
+ name;
+ space] @
params @
- [space; keyword "on" ; space ; rec_param ;space ] @
+ [keyword "on" ; space ; rec_param ;space ] @
(match ty with None -> [] | Some ty -> [builtin_symbol ":"; ty]) @
[ builtin_symbol "\\def";
break;