annotate src/mono_print.sml @ 2213:365727ff68f4

Complete overhaul: cache queries based on immediate query result, not eventual HTML output.
author Ziv Scully <ziv@mit.edu>
date Tue, 14 Oct 2014 18:05:09 -0400
parents 98895243b5b6
children 278e10629ba1
rev   line source
adam@1848 1 (* Copyright (c) 2008, 2013, Adam Chlipala
adamc@25 2 * All rights reserved.
adamc@25 3 *
adamc@25 4 * Redistribution and use in source and binary forms, with or without
adamc@25 5 * modification, are permitted provided that the following conditions are met:
adamc@25 6 *
adamc@25 7 * - Redistributions of source code must retain the above copyright notice,
adamc@25 8 * this list of conditions and the following disclaimer.
adamc@25 9 * - Redistributions in binary form must reproduce the above copyright notice,
adamc@25 10 * this list of conditions and the following disclaimer in the documentation
adamc@25 11 * and/or other materials provided with the distribution.
adamc@25 12 * - The names of contributors may not be used to endorse or promote products
adamc@25 13 * derived from this software without specific prior written permission.
adamc@25 14 *
adamc@25 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
adamc@25 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
adamc@25 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
adamc@25 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
adamc@25 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
adamc@25 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
adamc@25 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
adamc@25 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
adamc@25 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
adamc@25 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
adamc@25 25 * POSSIBILITY OF SUCH DAMAGE.
adamc@25 26 *)
adamc@25 27
adamc@244 28 (* Pretty-printing monomorphic Ur/Web *)
adamc@25 29
adamc@25 30 structure MonoPrint :> MONO_PRINT = struct
adamc@25 31
adamc@25 32 open Print.PD
adamc@25 33 open Print
adamc@25 34
adamc@25 35 open Mono
adamc@25 36
adamc@25 37 structure E = MonoEnv
adamc@25 38
adamc@25 39 val debug = ref false
adamc@25 40
adamc@252 41 val dummyt = (TRecord [], ErrorMsg.dummySpan)
adamc@252 42
adamc@25 43 fun p_typ' par env (t, _) =
adamc@25 44 case t of
adamc@25 45 TFun (t1, t2) => parenIf par (box [p_typ' true env t1,
adamc@25 46 space,
adamc@25 47 string "->",
adamc@25 48 space,
adamc@25 49 p_typ env t2])
adamc@25 50 | TRecord xcs => box [string "{",
adamc@25 51 p_list (fn (x, t) =>
adamc@25 52 box [string x,
adamc@25 53 space,
adamc@25 54 string ":",
adamc@25 55 space,
adamc@25 56 p_typ env t]) xcs,
adamc@25 57 string "}"]
adamc@841 58 | TDatatype (n, ref (dk, _)) =>
adamc@178 59 ((if !debug then
adamc@841 60 string (#1 (E.lookupDatatype env n) ^ "__" ^ Int.toString n ^ "["
adamc@841 61 ^ (case dk of
adamc@841 62 Option => "Option"
adamc@841 63 | Enum => "Enum"
adamc@841 64 | Default => "Default")
adamc@841 65 ^ "]")
adamc@178 66 else
adamc@178 67 string (#1 (E.lookupDatatype env n)))
adamc@178 68 handle E.UnboundNamed _ => string ("UNBOUND_DATATYPE_" ^ Int.toString n))
adamc@51 69 | TFfi (m, x) => box [string "FFI(", string m, string ".", string x, string ")"]
adamc@292 70 | TOption t => box [string "option(",
adamc@292 71 p_typ env t,
adamc@292 72 string ")"]
adamc@757 73 | TList t => box [string "list(",
adamc@757 74 p_typ env t,
adamc@757 75 string ")"]
adamc@577 76 | TSource => string "source"
adamc@568 77 | TSignal t => box [string "signal(",
adamc@568 78 p_typ env t,
adamc@568 79 string ")"]
adamc@25 80
adamc@25 81 and p_typ env = p_typ' false env
adamc@25 82
adamc@109 83 fun p_enamed env n =
adamc@178 84 (if !debug then
adamc@178 85 string (#1 (E.lookupENamed env n) ^ "__" ^ Int.toString n)
adamc@178 86 else
adamc@178 87 string (#1 (E.lookupENamed env n)))
adamc@178 88 handle E.UnboundNamed _ => string ("UNBOUNDN_" ^ Int.toString n)
adamc@178 89
adamc@178 90 fun p_con_named env n =
adamc@178 91 (if !debug then
adamc@178 92 string (#1 (E.lookupConstructor env n) ^ "__" ^ Int.toString n)
adamc@178 93 else
adamc@178 94 string (#1 (E.lookupConstructor env n)))
adamc@178 95 handle E.UnboundNamed _ => string ("CONSTRUCTOR_" ^ Int.toString n)
adamc@178 96
adamc@178 97 fun p_patCon env pc =
adamc@178 98 case pc of
adamc@178 99 PConVar n => p_con_named env n
adamc@186 100 | PConFfi {mod = m, con, ...} => box [string "FFIC(",
adamc@185 101 string m,
adamc@185 102 string ".",
adamc@185 103 string con,
adamc@185 104 string ")"]
adamc@178 105
adamc@178 106 fun p_pat' par env (p, _) =
adamc@178 107 case p of
adamc@178 108 PWild => string "_"
adamc@182 109 | PVar (s, _) => string s
adamc@178 110 | PPrim p => Prim.p_t p
adamc@188 111 | PCon (_, n, NONE) => p_patCon env n
adamc@188 112 | PCon (_, n, SOME p) => parenIf par (box [p_patCon env n,
adamc@288 113 space,
adamc@288 114 p_pat' true env p])
adamc@178 115 | PRecord xps =>
adamc@178 116 box [string "{",
adamc@182 117 p_list_sep (box [string ",", space]) (fn (x, p, _) =>
adamc@178 118 box [string x,
adamc@178 119 space,
adamc@178 120 string "=",
adamc@178 121 space,
adamc@178 122 p_pat env p]) xps,
adamc@178 123 string "}"]
adamc@288 124 | PNone _ => string "None"
adamc@757 125 | PSome (t, p) =>
adamc@757 126 if !debug then
adamc@757 127 box [string "Some[",
adamc@757 128 p_typ env t,
adamc@757 129 string "]",
adamc@757 130 space,
adamc@757 131 p_pat' true env p]
adamc@757 132 else
adamc@757 133 box [string "Some",
adamc@757 134 space,
adamc@757 135 p_pat' true env p]
adamc@178 136
adamc@178 137 and p_pat x = p_pat' false x
adamc@109 138
adamc@591 139 fun p_mode env m =
adamc@591 140 case m of
adamc@591 141 Attribute => string "Attribute"
adamc@591 142 | Script => string "Script"
adamc@591 143 | Source t => box [string "Source", space, p_typ env t]
adamc@591 144
adamc@25 145 fun p_exp' par env (e, _) =
adamc@25 146 case e of
adamc@25 147 EPrim p => Prim.p_t p
adamc@25 148 | ERel n =>
adamc@178 149 ((if !debug then
adamc@178 150 string (#1 (E.lookupERel env n) ^ "_" ^ Int.toString n)
adamc@178 151 else
adamc@178 152 string (#1 (E.lookupERel env n)))
adamc@178 153 handle E.UnboundRel _ => string ("UNBOUND_" ^ Int.toString n))
adamc@109 154 | ENamed n => p_enamed env n
adamc@188 155 | ECon (_, pc, NONE) => p_patCon env pc
adamc@188 156 | ECon (_, pc, SOME e) => parenIf par (box [p_patCon env pc,
adamc@188 157 space,
adamc@188 158 p_exp' true env e])
adamc@297 159 | ENone _ => string "None"
adamc@290 160 | ESome (_, e) => parenIf par (box [string "Some",
adamc@290 161 space,
adamc@290 162 p_exp' true env e])
adamc@109 163
adamc@51 164 | EFfi (m, x) => box [string "FFI(", string m, string ".", string x, string ")"]
adamc@51 165 | EFfiApp (m, x, es) => box [string "FFI(",
adamc@51 166 string m,
adamc@51 167 string ".",
adamc@51 168 string x,
adamc@51 169 string "(",
adam@1663 170 p_list (p_exp env o #1) es,
adamc@51 171 string "))"]
adamc@25 172 | EApp (e1, e2) => parenIf par (box [p_exp env e1,
adamc@25 173 space,
adamc@25 174 p_exp' true env e2])
adamc@252 175 | EAbs (x, t, _, e) => parenIf true (box [string "fn",
adamc@252 176 space,
adamc@252 177 string x,
adamc@252 178 space,
adamc@252 179 string ":",
adamc@252 180 space,
adamc@252 181 p_typ env t,
adamc@252 182 space,
adamc@252 183 string "=>",
adamc@252 184 space,
adamc@252 185 p_exp (E.pushERel env x t NONE) e])
adamc@25 186
adamc@387 187 | EUnop (s, e) => parenIf true (box [string s,
adamc@387 188 space,
adamc@387 189 p_exp' true env e])
adam@1360 190 | EBinop (_, s, e1, e2) => parenIf true (box [p_exp' true env e1,
adam@1360 191 space,
adam@1360 192 string s,
adam@1360 193 space,
adam@1360 194 p_exp' true env e2])
adamc@387 195
adamc@25 196 | ERecord xes => box [string "{",
adamc@29 197 p_list (fn (x, e, _) =>
adamc@25 198 box [string x,
adamc@25 199 space,
adamc@25 200 string "=",
adamc@25 201 space,
adamc@25 202 p_exp env e]) xes,
adamc@25 203 string "}"]
adamc@25 204 | EField (e, x) =>
adamc@25 205 box [p_exp' true env e,
adamc@25 206 string ".",
adamc@25 207 string x]
adamc@25 208
adamc@1107 209 | ECase (e, pes, {result, ...}) => parenIf true (box [string "case",
adamc@1107 210 space,
adamc@1107 211 p_exp env e,
adamc@1107 212 space,
adamc@1107 213 if !debug then
adamc@1107 214 box [string "return",
adamc@1107 215 space,
adamc@1107 216 p_typ env result,
adamc@1107 217 space]
adamc@1107 218 else
adamc@1107 219 box [],
adamc@1107 220 string "of",
adamc@1107 221 space,
adamc@1107 222 p_list_sep (box [space, string "|", space])
adamc@1107 223 (fn (p, e) => box [p_pat env p,
adamc@1107 224 space,
adamc@1107 225 string "=>",
adamc@1107 226 space,
adamc@1107 227 p_exp (E.patBinds env p) e])
adamc@1107 228 pes])
adamc@94 229
adamc@283 230 | EError (e, t) => box [string "(error",
adamc@283 231 space,
adamc@283 232 p_exp env e,
adamc@283 233 space,
adamc@283 234 string ":",
adamc@283 235 space,
adamc@283 236 p_typ env t,
adamc@283 237 string ")"]
adam@1932 238 | EReturnBlob {blob = SOME blob, mimeType, t} => box [string "(blob",
adam@1932 239 space,
adam@1932 240 p_exp env blob,
adam@1932 241 space,
adam@1932 242 string "in",
adam@1932 243 space,
adam@1932 244 p_exp env mimeType,
adam@1932 245 space,
adam@1932 246 string ":",
adam@1932 247 space,
adam@1932 248 p_typ env t,
adam@1932 249 string ")"]
adam@1932 250 | EReturnBlob {blob = NONE, mimeType, t} => box [string "(blob",
adam@1932 251 space,
adam@1932 252 string "<page>",
adam@1932 253 space,
adam@1932 254 string "in",
adam@1932 255 space,
adam@1932 256 p_exp env mimeType,
adam@1932 257 space,
adam@1932 258 string ":",
adam@1932 259 space,
adam@1932 260 p_typ env t,
adam@1932 261 string ")"]
adamc@1065 262 | ERedirect (e, t) => box [string "(redirect",
adamc@1065 263 space,
adamc@1065 264 p_exp env e,
adamc@1065 265 space,
adamc@1065 266 string ":",
adamc@1065 267 space,
adamc@1065 268 p_typ env t,
adamc@1065 269 string ")"]
adamc@283 270
adamc@331 271 | EStrcat (e1, e2) => parenIf par (box [p_exp' true env e1,
adamc@331 272 space,
adamc@331 273 string "^",
adamc@331 274 space,
adamc@331 275 p_exp env e2])
adamc@94 276
adamc@102 277 | EWrite e => box [string "write(",
adamc@102 278 p_exp env e,
adamc@102 279 string ")"]
adamc@102 280
adamc@578 281 | ESeq (e1, e2) => box [string "(",
adamc@578 282 p_exp env e1,
adamc@106 283 string ";",
adamc@106 284 space,
adamc@578 285 p_exp env e2,
adamc@578 286 string ")"]
adamc@252 287 | ELet (x, t, e1, e2) => box [string "(let",
adamc@251 288 space,
adamc@251 289 string x,
adamc@251 290 space,
adamc@251 291 string ":",
adamc@251 292 space,
adamc@251 293 p_typ env t,
adamc@251 294 space,
adamc@251 295 string "=",
adamc@251 296 space,
adamc@252 297 string "(",
adamc@251 298 p_exp env e1,
adamc@252 299 string ")",
adamc@251 300 space,
adamc@251 301 string "in",
adamc@251 302 space,
adamc@252 303 string "(",
adamc@252 304 p_exp (E.pushERel env x t NONE) e2,
adamc@252 305 string "))"]
adamc@106 306
adamc@111 307 | EClosure (n, es) => box [string "CLOSURE(",
adamc@111 308 p_enamed env n,
adamc@111 309 p_list_sep (string "") (fn e => box [string ", ",
adamc@111 310 p_exp env e]) es,
adamc@111 311 string ")"]
adamc@111 312
adamc@252 313 | EQuery {exps, tables, state, query, body, initial} =>
adamc@252 314 box [string "query[",
adamc@252 315 p_list (fn (x, t) => box [string x, space, string ":", space, p_typ env t]) exps,
adamc@252 316 string "] [",
adamc@252 317 p_list (fn (x, xts) => box [string x,
adamc@252 318 space,
adamc@252 319 string ":",
adamc@252 320 space,
adamc@252 321 string "{",
adamc@252 322 p_list (fn (x, t) => box [string x, space, string ":", space, p_typ env t]) xts,
adamc@252 323 string "}"]) tables,
adamc@252 324 string "] [",
adamc@252 325 p_typ env state,
adamc@252 326 string "]",
adamc@252 327 space,
adamc@252 328 p_exp env query,
adamc@252 329 space,
adamc@252 330 string "initial",
adamc@252 331 space,
adamc@252 332 p_exp env initial,
adamc@252 333 space,
adamc@252 334 string "in",
adamc@252 335 space,
adamc@252 336 p_exp (E.pushERel (E.pushERel env "r" dummyt NONE) "acc" dummyt NONE) body]
adam@1293 337 | EDml (e, _) => box [string "dml(",
adam@1293 338 p_exp env e,
adam@1293 339 string ")"]
adamc@338 340 | ENextval e => box [string "nextval(",
adamc@338 341 p_exp env e,
adamc@338 342 string ")"]
adamc@1073 343 | ESetval (e1, e2) => box [string "setval(",
adamc@1073 344 p_exp env e1,
adamc@1073 345 string ",",
adamc@1073 346 space,
adamc@1073 347 p_exp env e2,
adamc@1073 348 string ")"]
adamc@1112 349 | EUnurlify (e, _, _) => box [string "unurlify(",
adamc@1112 350 p_exp env e,
adamc@1112 351 string ")"]
adamc@815 352 | EJavaScript (m, e) => box [string "JavaScript(",
adamc@815 353 p_mode env m,
adamc@815 354 string ",",
adamc@815 355 space,
adamc@815 356 p_exp env e,
adamc@815 357 string ")"]
adamc@568 358
adamc@568 359 | ESignalReturn e => box [string "Return(",
adamc@568 360 p_exp env e,
adamc@568 361 string ")"]
adamc@574 362 | ESignalBind (e1, e2) => box [string "Bind(",
adamc@572 363 p_exp env e1,
adamc@572 364 string ",",
adamc@572 365 space,
adamc@572 366 p_exp env e2,
adamc@572 367 string ")"]
adamc@574 368 | ESignalSource e => box [string "Source(",
adamc@574 369 p_exp env e,
adamc@574 370 string ")"]
adamc@252 371
adam@1848 372 | EServerCall (n, _, _, _) => box [string "Server(",
adamc@1020 373 p_exp env n,
adamc@1020 374 string ")"]
adamc@1021 375 | ERecv (n, _) => box [string "Recv(",
adamc@1021 376 p_exp env n,
adamc@1021 377 string ")"]
adamc@1021 378 | ESleep n => box [string "Sleep(",
adamc@1021 379 p_exp env n,
adamc@1021 380 string ")"]
adamc@1021 381 | ESpawn n => box [string "Spawn(",
adamc@1021 382 p_exp env n,
adamc@1021 383 string ")"]
adamc@608 384
adamc@25 385 and p_exp env = p_exp' false env
adamc@25 386
adamc@126 387 fun p_vali env (x, n, t, e, s) =
adamc@126 388 let
adamc@126 389 val xp = if !debug then
adamc@126 390 box [string x,
adamc@126 391 string "__",
adamc@126 392 string (Int.toString n)]
adamc@126 393 else
adamc@126 394 string x
adamc@126 395 in
adamc@126 396 box [xp,
adamc@126 397 space,
adamc@126 398 string "as",
adamc@126 399 space,
adamc@126 400 string s,
adamc@126 401 space,
adamc@126 402 string ":",
adamc@126 403 space,
adamc@126 404 p_typ env t,
adamc@126 405 space,
adamc@126 406 string "=",
adamc@126 407 space,
adamc@126 408 p_exp env e]
adamc@126 409 end
adamc@126 410
adamc@164 411 fun p_datatype env (x, n, cons) =
adamc@164 412 let
adamc@168 413 val env = E.pushDatatype env x n cons
adamc@164 414 in
adam@1734 415 box [if !debug then (string (x ^ "__" ^ Int.toString n))
adam@1734 416 else string x,
adamc@164 417 space,
adamc@164 418 string "=",
adamc@164 419 space,
adamc@164 420 p_list_sep (box [space, string "|", space])
adamc@164 421 (fn (x, n, NONE) => if !debug then (string (x ^ "__" ^ Int.toString n))
adamc@164 422 else string x
adamc@164 423 | (x, _, SOME t) => box [if !debug then (string (x ^ "__" ^ Int.toString n))
adamc@164 424 else string x, space, string "of", space, p_typ env t])
adamc@164 425 cons]
adamc@164 426 end
adamc@164 427
adamc@1199 428 fun p_policy env pol =
adamc@1199 429 case pol of
adamc@1214 430 PolClient e => box [string "sendClient",
adamc@1214 431 space,
adamc@1214 432 p_exp env e]
adamc@1220 433 | PolInsert e => box [string "mayInsert",
adamc@1220 434 space,
adamc@1220 435 p_exp env e]
adamc@1221 436 | PolDelete e => box [string "mayDelete",
adamc@1221 437 space,
adamc@1221 438 p_exp env e]
adamc@1223 439 | PolUpdate e => box [string "mayUpdate",
adamc@1223 440 space,
adamc@1223 441 p_exp env e]
adamc@1229 442 | PolSequence e => box [string "sendOwnIds",
adamc@1229 443 space,
adamc@1229 444 p_exp env e]
adamc@1199 445
adamc@126 446 fun p_decl env (dAll as (d, _) : decl) =
adamc@25 447 case d of
adamc@808 448 DDatatype x => box [string "datatype",
adamc@808 449 space,
adamc@808 450 p_list_sep (box [space, string "and", space]) (p_datatype (E.declBinds env dAll)) x]
adamc@164 451 | DVal vi => box [string "val",
adamc@126 452 space,
adamc@126 453 p_vali env vi]
adamc@126 454 | DValRec vis =>
adamc@25 455 let
adamc@126 456 val env = E.declBinds env dAll
adamc@25 457 in
adamc@25 458 box [string "val",
adamc@25 459 space,
adamc@126 460 string "rec",
adamc@25 461 space,
adamc@126 462 p_list_sep (box [newline, string "and", space]) (p_vali env) vis]
adamc@25 463 end
adamc@109 464
adamc@1104 465 | DExport (ek, s, n, ts, t, _) => box [string "export",
adamc@1104 466 space,
adamc@1104 467 Export.p_export_kind ek,
adamc@1104 468 space,
adamc@1104 469 p_enamed env n,
adamc@1104 470 space,
adamc@1104 471 string "as",
adamc@1104 472 space,
adamc@1104 473 string s,
adamc@1104 474 p_list_sep (string "") (fn t => box [space,
adamc@1104 475 string "(",
adamc@1104 476 p_typ env t,
adamc@1104 477 string ")"]) ts,
adamc@1104 478 space,
adamc@1104 479 string "->",
adamc@1104 480 space,
adamc@1104 481 p_typ env t]
adamc@271 482
adamc@707 483 | DTable (s, xts, pe, ce) => box [string "(* SQL table ",
adamc@707 484 string s,
adamc@707 485 space,
adamc@707 486 string ":",
adamc@707 487 space,
adamc@707 488 p_list (fn (x, t) => box [string x,
adamc@707 489 space,
adamc@707 490 string ":",
adamc@707 491 space,
adamc@707 492 p_typ env t]) xts,
adamc@707 493 space,
adamc@707 494 string "keys",
adamc@707 495 space,
adamc@707 496 p_exp env pe,
adamc@707 497 space,
adamc@707 498 string "constraints",
adamc@707 499 space,
adamc@707 500 p_exp env ce,
adamc@707 501 space,
adamc@707 502 string "*)"]
adamc@338 503 | DSequence s => box [string "(* SQL sequence ",
adamc@338 504 string s,
adamc@338 505 string "*)"]
adamc@754 506 | DView (s, _, e) => box [string "(* SQL view ",
adamc@754 507 string s,
adamc@754 508 space,
adamc@754 509 string "as",
adamc@754 510 space,
adamc@754 511 p_exp env e,
adamc@754 512 string "*)"]
adamc@687 513 | DDatabase {name, expunge, initialize} => box [string "database",
adamc@687 514 space,
adamc@687 515 string name,
adamc@687 516 space,
adamc@687 517 string "(",
adamc@687 518 p_enamed env expunge,
adamc@687 519 string ",",
adamc@687 520 space,
adamc@687 521 p_enamed env initialize,
adamc@687 522 string ")"]
adamc@569 523 | DJavaScript s => box [string "JavaScript(",
adamc@569 524 string s,
adamc@569 525 string ")"]
adamc@569 526
adamc@725 527 | DCookie s => box [string "cookie",
adamc@725 528 space,
adamc@725 529 string s]
adamc@720 530 | DStyle s => box [string "style",
adamc@720 531 space,
adamc@720 532 string s]
adamc@1075 533 | DTask (e1, e2) => box [string "task",
adamc@1073 534 space,
adamc@1075 535 p_exp env e1,
adamc@1075 536 space,
adamc@1075 537 string "=",
adamc@1075 538 space,
adamc@1075 539 p_exp env e2]
adamc@1199 540 | DPolicy p => box [string "policy",
adamc@1199 541 space,
adamc@1199 542 p_policy env p]
adam@1294 543 | DOnError _ => string "ONERROR"
adamc@100 544
adam@1845 545 fun p_file env (file, _) =
adamc@25 546 let
adamc@31 547 val (pds, _) = ListUtil.foldlMap (fn (d, env) =>
adamc@31 548 (p_decl env d,
adamc@31 549 E.declBinds env d))
adamc@25 550 env file
adamc@25 551 in
adamc@25 552 p_list_sep newline (fn x => x) pds
adamc@25 553 end
adamc@25 554
adamc@25 555 end