lean4 icon indicating copy to clipboard operation
lean4 copied to clipboard

Suppress field names with default values during delaboration

Open leodemoura opened this issue 3 years ago • 1 comments

The following example

import Lean
open Lean.Meta
#check ({} : Context)

produces

{ config :=
    { foApprox := false, ctxApprox := false, quasiPatternApprox := false, constApprox := false, isDefEqStuckEx := false,
      transparency := TransparencyMode.default, zetaNonDep := true, trackZeta := false, unificationHints := true,
      proofIrrelevance := true, assignSyntheticOpaque := false, ignoreLevelMVarDepth := true, offsetCnstrs := true,
      etaStruct := true },
  lctx :=
    { fvarIdToDecl :=
        { root := Std.PersistentHashMap.Node.entries Std.PersistentHashMap.mkEmptyEntriesArray, size := 0 },
      decls :=
        { root := Std.PersistentArrayNode.node (Array.mkEmpty (USize.toNat Std.PersistentArray.branching)),
          tail := Array.mkEmpty (USize.toNat Std.PersistentArray.branching), size := 0,
          shift := Std.PersistentArray.initShift, tailOff := 0 } },
  localInstances := #[], defEqCtx? := none, synthPendingDepth := 0, canUnfold? := none }

It would be nice to have an option to disable fields that have default values when delaborating structure instances. This feature is relevant for the doc-gen4. See https://leanprover-community.github.io/mathlib4_docs/Lean/Meta/Basic.html#Lean.Meta.MetaM.run

leodemoura avatar Apr 09 '22 15:04 leodemoura

@kha It would be really nice to have. It will also affect the InfoView.

leodemoura avatar Jun 01 '22 23:06 leodemoura