Zulip Chat Archive

Stream: mathlib4

Topic: FromJson for String


Paige Thomas (Jan 05 2024 at 02:55):

Do I need to derive this instance manually? If so, how would I do so?

structure VarName extends String
  deriving Inhabited, DecidableEq, Lean.FromJson
failed to synthesize instance
  Lean.FromJson (List Char)

Paige Thomas (Jan 05 2024 at 03:17):

instance : Lean.FromJson VarName :=
  { fromJson? := fun (json : Lean.Json) => do
    let str  Lean.fromJson? json
    Except.ok (VarName.mk str) }

?


Last updated: May 02 2025 at 03:31 UTC