-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpptypelist.sml
68 lines (50 loc) · 1.95 KB
/
pptypelist.sml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
(* Copyright 1991 by AT&T Bell Laboratories *)
(* Modified for Poly Rec by H.Leiss, cis.uni-muenchen.de *)
signature PPTYPELIST =
sig
type ineq
val ppineqlist : StaticEnv.staticEnv -> PrettyPrint.stream -> ineq list -> unit
val pptypelist : StaticEnv.staticEnv -> PrettyPrint.stream -> Types.ty list -> unit
end
structure PPTypelist :PPTYPELIST =
struct
local open ErrorMsg Types List PPUtil
in
structure PP = PrettyPrint
type ineq = Semiunify.ineq
val pps = PP.string
val debugging = ref false ; (* Control.debugging (* bool ref *) *)
fun ppType env ppstrm ty =
if !debugging then
ElabDebug.withInternals (fn () => PPType.ppType env ppstrm ty)
else PPType.ppType env ppstrm ty
fun ppineqlist1 env ppstrm L =
let val pps = PP.string ppstrm
in
app (fn (Semiunify.ineq(Semiunify.mylab(_,lab),i,ty1,ty2)) =>
(PP.openHVBox ppstrm (PP.Rel 0);
pps "(";
ppType env ppstrm ty1;
pps " <"; pps (Int.toString i); pps " ";
pps (Symbol.name lab); pps " ";
ppType env ppstrm ty2;
pps ")";
PP.newline ppstrm;
PP.closeBox ppstrm)) L
end
and pptypelist1 env ppstrm (ty::rest) =
(ppType env ppstrm ty;
PP.string ppstrm ", ";
pptypelist1 env ppstrm rest)
| pptypelist1 env ppstrm [] = ()
and ppineqlist (env:StaticEnv.staticEnv) ppstrm (ineqs:ineq list) : unit =
(PP.openHOVBox ppstrm (PP.Rel 1);
ppineqlist1 env ppstrm ineqs;
PP.closeBox ppstrm)
and pptypelist (env:StaticEnv.staticEnv) ppstrm (tylist:ty list) : unit =
(PP.openHOVBox ppstrm (PP.Rel 1);
pptypelist1 env ppstrm tylist;
PP.closeBox ppstrm)
val g = PrettyPrint.with_pp(ErrorMsg.defaultConsumer())
end
end (* structure PPTypelist *)