Equations
- Lean.instFromJsonJson = { fromJson? := Except.ok }
Equations
- Lean.instToJsonJson = { toJson := id }
Equations
- Lean.instFromJsonJsonNumber = { fromJson? := Lean.Json.getNum? }
Equations
- Lean.instToJsonJsonNumber = { toJson := Lean.Json.num }
Equations
- Lean.instFromJsonBool = { fromJson? := Lean.Json.getBool? }
Equations
- Lean.instToJsonBool = { toJson := fun b => Lean.Json.bool b }
Equations
- Lean.instFromJsonNat = { fromJson? := Lean.Json.getNat? }
Equations
- Lean.instToJsonNat = { toJson := fun n => Lean.Json.num (Lean.JsonNumber.fromNat n) }
Equations
- Lean.instFromJsonInt = { fromJson? := Lean.Json.getInt? }
Equations
- Lean.instToJsonInt = { toJson := fun n => Lean.Json.num (Lean.JsonNumber.fromInt n) }
Equations
- Lean.instFromJsonString = { fromJson? := Lean.Json.getStr? }
Equations
- Lean.instToJsonString = { toJson := fun s => Lean.Json.str s }
Equations
- Lean.instFromJsonFilePath = { fromJson? := fun j => System.FilePath.mk <$> Lean.Json.getStr? j }
Equations
- Lean.instToJsonFilePath = { toJson := fun p => Lean.Json.str p.toString }
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.instToJsonArray = { toJson := fun a => Lean.Json.arr (Array.map Lean.toJson a) }
Equations
- Lean.instFromJsonList = { fromJson? := fun j => Except.map Array.toList (Lean.fromJson? j) }
Equations
- Lean.instToJsonList = { toJson := fun xs => Lean.toJson (List.toArray xs) }
Equations
- Lean.instFromJsonOption = { fromJson? := fun x => match x with | Lean.Json.null => Except.ok none | j => some <$> Lean.fromJson? j }
Equations
- Lean.instToJsonOption = { toJson := fun x => match x with | none => Lean.Json.null | some a => Lean.toJson a }
instance
Lean.instFromJsonProd
{α : Type u}
{β : Type v}
[Lean.FromJson α]
[Lean.FromJson β]
:
Lean.FromJson (α × β)
Equations
- One or more equations did not get rendered due to their size.
instance
Lean.instToJsonProd
{α : Type u_1}
{β : Type u_2}
[Lean.ToJson α]
[Lean.ToJson β]
:
Lean.ToJson (α × β)
Equations
- Lean.instToJsonProd = { toJson := fun x => match x with | (a, b) => Lean.Json.arr #[Lean.toJson a, Lean.toJson b] }
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.instToJsonName = { toJson := fun n => Lean.Json.str (toString n) }
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.instToJsonUSize = { toJson := fun v => Lean.bignumToJson (USize.toNat v) }
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.instToJsonUInt64 = { toJson := fun v => Lean.bignumToJson (UInt64.toNat v) }
Equations
- Lean.instToJsonFloat = { toJson := fun x => match Lean.JsonNumber.fromFloat? x with | Sum.inl e => Lean.Json.str e | Sum.inr n => Lean.Json.num n }
Equations
- One or more equations did not get rendered due to their size.
instance
Lean.instToJsonRBMapString
{α : Type}
{cmp : String → String → Ordering}
[Lean.ToJson α]
:
Lean.ToJson (Lean.RBMap String α cmp)
Equations
- Lean.instToJsonRBMapString = { toJson := fun m => Lean.Json.obj (Lean.RBNode.map (fun x => Lean.toJson) m.val) }
instance
Lean.instFromJsonRBMapString
{α : Type}
{cmp : String → String → Ordering}
[Lean.FromJson α]
:
Lean.FromJson (Lean.RBMap String α cmp)
Equations
- Lean.instFromJsonRBMapString = { fromJson? := fun j => do let o ← Lean.Json.getObj? j Lean.RBNode.foldM (fun x k v => Lean.RBMap.insert x k <$> Lean.fromJson? v) ∅ o }
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.Json.instToJsonStructured = { toJson := fun x => match x with | Lean.Json.Structured.arr a => Lean.Json.arr a | Lean.Json.Structured.obj o => Lean.Json.obj o }
Equations
- Lean.Json.getObjValAs? j α k = Lean.fromJson? (Lean.Json.getObjValD j k)
Instances For
Equations
- Lean.Json.setObjValAs! j k v = Lean.Json.setObjVal! j k (Lean.toJson v)
Instances For
Equations
- Lean.Json.opt k x = match x with | none => [] | some o => [(k, Lean.toJson o)]