Mercurial > urweb
comparison src/elab_ops.sml @ 1735:ec47f49c6aa3
In simplifying constructors for error messages, unfold constructor synonyms from modules
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Wed, 02 May 2012 08:23:30 -0400 |
parents | dd12d6d9e9a7 |
children |
comparison
equal
deleted
inserted
replaced
1734:d2b3fada532e | 1735:ec47f49c6aa3 |
---|---|
334 | CRel _ => cAll | 334 | CRel _ => cAll |
335 | CNamed xn => | 335 | CNamed xn => |
336 (case E.lookupCNamed env xn of | 336 (case E.lookupCNamed env xn of |
337 (_, _, SOME c') => reduceCon env c' | 337 (_, _, SOME c') => reduceCon env c' |
338 | _ => cAll) | 338 | _ => cAll) |
339 | CModProj _ => cAll | 339 | CModProj (n, ms, x) => |
340 let | |
341 val (_, sgn) = E.lookupStrNamed env n | |
342 val (str, sgn) = foldl (fn (m, (str, sgn)) => | |
343 case E.projectStr env {sgn = sgn, str = str, field = m} of | |
344 NONE => raise Fail "reduceCon: Unknown substructure" | |
345 | SOME sgn => ((StrProj (str, m), loc), sgn)) | |
346 ((StrVar n, loc), sgn) ms | |
347 in | |
348 case E.projectCon env {sgn = sgn, str = str, field = x} of | |
349 NONE => raise Fail "reduceCon: kindof: Unknown con in structure" | |
350 | SOME (_, NONE) => cAll | |
351 | SOME (_, SOME c) => reduceCon env c | |
352 end | |
353 | |
340 | CApp (c1, c2) => | 354 | CApp (c1, c2) => |
341 let | 355 let |
342 val c1 = reduceCon env c1 | 356 val c1 = reduceCon env c1 |
343 val c2 = reduceCon env c2 | 357 val c2 = reduceCon env c2 |
344 fun default () = (CApp (c1, c2), loc) | 358 fun default () = (CApp (c1, c2), loc) |