lean4-htt/tests/lean/structure_instance_info.lean
Sebastian Ullrich 0aacccd8c9 feat(frontends/lean): change structure update notation
`{s with ...}` is now `{..., ..s}`, which more clearly expresses that the
result type is not necessarily equal to the type of `s` (in absence of an
expected type and a structure name, we still default to the type of `s`).

Multiple fallback sources can be given: `{..., ..s, ..t}` will fall back to
searching a field in `s`, then in `t`. The last component can also be `..`,
which will replace any missing fields with a placeholder.

The old notation will be removed in the future.
2017-11-17 16:40:47 -08:00

9 lines
461 B
Text

open tactic
run_cmd
do let e := pexpr.mk_structure_instance { struct := some "prod", field_names := ["fst", "snd"], field_values := [``(1), ``(2)] },
let f := pexpr.mk_structure_instance { field_names := ["snd"], field_values := [``(1)], sources := [e] },
to_expr e >>= trace,
to_expr f >>= trace,
trace $ e.get_structure_instance_info >>= structure_instance_info.struct,
trace $ f.get_structure_instance_info >>= structure_instance_info.struct