Instances
- Lean.Lsp.instFromJsonRpcRef
- Lean.Lsp.instFromJsonDidChangeWatchedFilesParams
- Lean.Lsp.instFromJsonTextEdit
- Lean.Lsp.instFromJsonFileSystemWatcher
- Lean.Lsp.instFromJsonDocumentHighlightParams
- Lean.Lsp.instFromJsonCancelParams
- Lean.instFromJsonJson
- Lean.Lsp.instFromJsonInitializationOptions
- Lean.Lsp.instFromJsonCompletionParams
- Lean.instFromJsonLeanPaths
- Lean.Lsp.instFromJsonLeanFileProgressProcessingInfo
- Lean.Lsp.instFromJsonSemanticTokensOptions
- Lean.Lsp.instFromJsonRefInfo
- Lean.Server.instFromJsonIlean
- Lean.instFromJsonJsonNumber
- Lean.Lsp.instFromJsonModuleRefs
- Lean.Lsp.instFromJsonCompletionItemKind
- Lean.Widget.Lean.Widget.InteractiveHypothesis.instFromJsonRpcEncodingPacket
- Lean.Lsp.instFromJsonDocumentSelector
- Lean.Lsp.instFromJsonDiagnosticSeverity
- Lean.Lsp.instFromJsonTextDocumentChangeRegistrationOptions
- Lean.Widget.Lean.Widget.MsgToInteractive.instFromJsonRpcEncodingPacket
- Lean.Lsp.instFromJsonSemanticTokensLegend
- Lean.Lsp.instFromJsonCompletionItem
- Lean.Lsp.instFromJsonRpcConnectParams
- Lean.Lsp.instFromJsonPlainGoalParams
- Lean.Widget.Lean.Widget.CodeToken.instFromJsonRpcEncodingPacket
- Lean.Lsp.instFromJsonDidCloseTextDocumentParams
- Lean.Lsp.instFromJsonHoverParams
- Lean.Lsp.instFromJsonDocumentFilter
- Lean.Lsp.instFromJsonTextDocumentEdit
- Lean.Lsp.instFromJsonLeanIleanInfoParams
- Lean.Lsp.instFromJsonPlainTermGoalParams
- Lean.Widget.MsgEmbed.instFromJsonRpcEncodingPacket
- Lean.instFromJsonOption
- Lean.Lsp.instFromJsonClientInfo
- Lean.Lsp.instFromJsonPosition
- Lean.Lsp.instFromJsonInitializeResult
- Lean.Lsp.instFromJsonTextDocumentClientCapabilities
- Lean.Lsp.instFromJsonTextDocumentPositionParams
- Lean.Lsp.instFromJsonClientCapabilities
- Lean.Lsp.instFromJsonLeanFileProgressKind
- Lean.instFromJsonUInt64
- Lean.Lsp.instFromJsonCompletionList
- Lean.Lsp.instFromJsonServerInfo
- Lean.Lsp.instFromJsonCompletionItemCapabilities
- Lean.Lsp.instFromJsonSemanticTokensParams
- Lean.Widget.Lean.Widget.InteractiveGoals.instFromJsonRpcEncodingPacket
- Lean.Lsp.instFromJsonDeclarationParams
- Lean.Lsp.instFromJsonSaveOptions
- Lean.Lsp.instFromJsonDiagnosticCode
- Lean.Lsp.instFromJsonCompletionClientCapabilities
- Lean.Lsp.instFromJsonDiagnosticRelatedInformation
- Lean.Widget.Lean.Widget.InteractiveTermGoal.instFromJsonRpcEncodingPacket
- Lean.Lsp.instFromJsonWaitForDiagnostics
- Lean.Lsp.instFromJsonDocumentSymbolParams
- Lean.Lsp.instFromJsonFileChangeType
- Lean.Lsp.instFromJsonDiagnosticTag
- Lean.Lsp.instFromJsonInitializeParams
- Lean.Lsp.instFromJsonPlainGoal
- Lean.Lsp.instFromJsonStaticRegistrationOptions
- Lean.Lsp.instFromJsonLocationLink
- Lean.instFromJsonList
- Lean.Widget.instFromJsonTaggedText
- Lean.Lsp.instFromJsonLineRange
- Lean.Lsp.instFromJsonRpcConnected
- Lean.Lsp.instFromJsonDidChangeTextDocumentParams
- Lean.Lsp.instFromJsonDiagnosticWith
- Lean.Lsp.instFromJsonPublishDiagnosticsParams
- Lean.Widget.Lean.Widget.InfoPopup.instFromJsonRpcEncodingPacket
- Lean.Lsp.instFromJsonServerCapabilities
- Lean.JsonRpc.instFromJsonNotification
- Lean.Json.instFromJsonStructured
- Lean.Lsp.instFromJsonCompletionOptions
- Lean.instFromJsonNat
- Lean.Lsp.instFromJsonSemanticTokensRangeParams
- Lean.JsonRpc.instFromJsonRequestID
- Lean.Lsp.instFromJsonReferenceParams
- Lean.Lsp.instFromJsonRange
- Lean.Lsp.instFromJsonRpcCallParams
- Lean.Lsp.instFromJsonRpcKeepAliveParams
- Lean.JsonRpc.instFromJsonErrorCode
- Lean.instFromJsonArray
- Lean.Lsp.instFromJsonTextDocumentSyncOptions
- Lean.Lsp.instFromJsonRegistration
- Lean.Lsp.instFromJsonTextDocumentIdentifier
- Lean.Lsp.instFromJsonVersionedTextDocumentIdentifier
- Lean.instFromJsonProd
- Lean.Lsp.instFromJsonWaitForDiagnosticsParams
- Lean.Lsp.instFromJsonTextDocumentRegistrationOptions
- Lean.instFromJsonFilePath
- Lean.Widget.instFromJsonGetInteractiveDiagnosticsParams
- Lean.Lsp.instFromJsonLeanFileProgressParams
- Lean.Lsp.instFromJsonWorkspaceFolder
- Lean.Lsp.instFromJsonLocation
- Lean.Lsp.instFromJsonReferenceContext
- Lean.Lsp.instFromJsonDidChangeWatchedFilesRegistrationOptions
- Lean.Lsp.instFromJsonTrace
- Lean.instFromJsonBool
- Lean.Lsp.instFromJsonRpcReleaseParams
- Lean.Lsp.instFromJsonTextDocumentSyncKind
- Lean.Lsp.instFromJsonCommand
- Lean.Lsp.instFromJsonTypeDefinitionParams
- Lean.Widget.Lean.Widget.InteractiveGoal.instFromJsonRpcEncodingPacket
- Lean.JsonRpc.instFromJsonMessage
- Lean.Lsp.instFromJsonPlainTermGoal
- Lean.Lsp.instFromJsonInitializedParams
- Lean.Lsp.instFromJsonTextDocumentItem
- Lean.Lsp.instFromJsonTextDocumentContentChangeEvent
- Lean.Lsp.instFromJsonInsertReplaceEdit
- Lean.Lsp.instFromJsonMarkupContent
- Lean.Lsp.instFromJsonRegistrationParams
- Lean.instFromJsonName
- Lean.Lsp.instFromJsonTextEditBatch
- Lean.Lsp.instFromJsonDefinitionParams
- Lean.instFromJsonString
- Lean.instFromJsonUSize
- Lean.Lsp.instFromJsonWorkspaceSymbolParams
- Lean.Lsp.instFromJsonMarkupKind
- Lean.Lsp.instFromJsonFileEvent
- Lean.Lsp.instFromJsonHover
- Lean.Lsp.instFromJsonDidOpenTextDocumentParams
- Lean.Lsp.instFromJsonSemanticTokens
- Lean.instFromJsonInt
- toJson : α → Lean.Json
Instances
- Lean.Lsp.instToJsonRpcRef
- Lean.Lsp.instToJsonSymbolInformation
- Lean.Lsp.instToJsonDidChangeWatchedFilesParams
- Lean.Lsp.instToJsonTextEdit
- Lean.Lsp.instToJsonDocumentSymbolAux
- Lean.Lsp.instToJsonFileSystemWatcher
- Lean.Lsp.instToJsonDocumentHighlightParams
- Lean.Lsp.instToJsonCancelParams
- Lean.instToJsonJson
- Lean.Lsp.instToJsonInitializationOptions
- Lean.Lsp.instToJsonCompletionParams
- Lean.instToJsonLeanPaths
- Lean.Lsp.instToJsonLeanFileProgressProcessingInfo
- Lean.Lsp.instToJsonSemanticTokensOptions
- Lean.Lsp.instToJsonRefInfo
- Lean.Server.instToJsonIlean
- Lean.instToJsonJsonNumber
- Lean.Lsp.instToJsonModuleRefs
- Lean.Lsp.instToJsonCompletionItemKind
- Lean.Widget.Lean.Widget.InteractiveHypothesis.instToJsonRpcEncodingPacket
- Lean.Lsp.instToJsonSymbolTag
- Lean.Lsp.instToJsonDocumentSelector
- Lean.Lsp.instToJsonDiagnosticSeverity
- Lean.Lsp.instToJsonDocumentHighlight
- Lean.Widget.Lean.Widget.MsgToInteractive.instToJsonRpcEncodingPacket
- Lean.Lsp.instToJsonSemanticTokensLegend
- Lean.Lsp.instToJsonCompletionItem
- Lean.Lsp.instToJsonRpcConnectParams
- Lean.Lsp.instToJsonPlainGoalParams
- Lean.Widget.Lean.Widget.CodeToken.instToJsonRpcEncodingPacket
- Lean.Lsp.instToJsonDidCloseTextDocumentParams
- Lean.Lsp.instToJsonSymbolKind
- Lean.Lsp.instToJsonHoverParams
- Lean.Lsp.instToJsonDocumentFilter
- Lean.Lsp.instToJsonTextDocumentEdit
- Lean.Lsp.instToJsonLeanIleanInfoParams
- Lean.Lsp.instToJsonPlainTermGoalParams
- Lean.Widget.MsgEmbed.instToJsonRpcEncodingPacket
- Lean.instToJsonOption
- Lean.Lsp.instToJsonClientInfo
- Lean.Lsp.instToJsonPosition
- Lean.Lsp.instToJsonInitializeResult
- Lean.Lsp.instToJsonTextDocumentClientCapabilities
- Lean.Lsp.instToJsonTextDocumentPositionParams
- Lean.Lsp.instToJsonClientCapabilities
- Lean.Lsp.instToJsonLeanFileProgressKind
- Lean.Lsp.instToJsonDocumentSymbolResult
- Lean.instToJsonUInt64
- Lean.Lsp.instToJsonCompletionList
- Lean.Lsp.instToJsonServerInfo
- Lean.Lsp.instToJsonWorkDoneProgressBegin
- Lean.Lsp.instToJsonCompletionItemCapabilities
- Lean.Lsp.instToJsonSemanticTokensParams
- Lean.Widget.Lean.Widget.InteractiveGoals.instToJsonRpcEncodingPacket
- Lean.Lsp.instToJsonDeclarationParams
- Lean.Lsp.instToJsonSaveOptions
- Lean.Lsp.instToJsonDiagnosticCode
- Lean.Lsp.instToJsonCompletionClientCapabilities
- Lean.Lsp.instToJsonDiagnosticRelatedInformation
- Lean.Widget.Lean.Widget.InteractiveTermGoal.instToJsonRpcEncodingPacket
- Lean.Lsp.instToJsonWaitForDiagnostics
- Lean.Lsp.instToJsonDocumentSymbolParams
- Lean.Lsp.instToJsonFileChangeType
- Lean.Lsp.instToJsonDiagnosticTag
- Lean.Lsp.instToJsonInitializeParams
- Lean.Lsp.instToJsonPlainGoal
- Lean.Lsp.instToJsonProgressParams
- Lean.Lsp.instToJsonStaticRegistrationOptions
- Lean.Lsp.instToJsonLocationLink
- Lean.instToJsonList
- Lean.Widget.instToJsonTaggedText
- Lean.Lsp.instToJsonLineRange
- Lean.Lsp.instToJsonRpcConnected
- Lean.Lsp.instToJsonDidChangeTextDocumentParams
- Lean.Lsp.instToJsonDiagnosticWith
- Lean.Lsp.instToJsonWorkDoneProgressEnd
- Lean.Lsp.instToJsonPublishDiagnosticsParams
- Lean.Widget.Lean.Widget.InfoPopup.instToJsonRpcEncodingPacket
- Lean.Lsp.instToJsonServerCapabilities
- Lean.Json.instToJsonStructured
- Lean.Lsp.instToJsonCompletionOptions
- Lean.instToJsonNat
- Lean.Lsp.instToJsonSemanticTokensRangeParams
- Lean.JsonRpc.instToJsonRequestID
- Lean.Lsp.instToJsonReferenceParams
- Lean.Lsp.instToJsonRange
- Lean.Lsp.instToJsonRpcCallParams
- Lean.Lsp.instToJsonRpcKeepAliveParams
- Lean.JsonRpc.instToJsonErrorCode
- Lean.instToJsonArray
- Lean.Lsp.instToJsonTextDocumentSyncOptions
- Lean.Lsp.instToJsonRegistration
- Lean.Lsp.instToJsonDocumentHighlightKind
- Lean.Lsp.instToJsonWorkDoneProgressReport
- Lean.Lsp.instToJsonTextDocumentIdentifier
- Lean.Lsp.instToJsonVersionedTextDocumentIdentifier
- Lean.instToJsonProd
- Lean.Lsp.instToJsonWaitForDiagnosticsParams
- Lean.Lsp.instToJsonTextDocumentRegistrationOptions
- Lean.instToJsonFilePath
- Lean.Widget.instToJsonGetInteractiveDiagnosticsParams
- Lean.Lsp.instToJsonLeanFileProgressParams
- Lean.Lsp.instToJsonWorkspaceFolder
- Lean.Lsp.instToJsonLocation
- Lean.Lsp.instToJsonReferenceContext
- Lean.Lsp.instToJsonDidChangeWatchedFilesRegistrationOptions
- Lean.Lsp.Trace.hasToJson
- Lean.instToJsonBool
- Lean.Lsp.instToJsonRpcReleaseParams
- Lean.Lsp.instToJsonTextDocumentSyncKind
- Lean.Lsp.instToJsonCommand
- Lean.Lsp.instToJsonTypeDefinitionParams
- Lean.Widget.Lean.Widget.InteractiveGoal.instToJsonRpcEncodingPacket
- Lean.JsonRpc.instToJsonMessage
- Lean.Lsp.instToJsonPlainTermGoal
- Lean.Lsp.instToJsonInitializedParams
- Lean.Lsp.instToJsonTextDocumentItem
- Lean.Lsp.instToJsonDocumentSymbol
- Lean.Lsp.TextDocumentContentChangeEvent.hasToJson
- Lean.Lsp.instToJsonInsertReplaceEdit
- Lean.Lsp.instToJsonMarkupContent
- Lean.Lsp.instToJsonRegistrationParams
- Lean.instToJsonName
- Lean.Lsp.instToJsonTextEditBatch
- Lean.Lsp.instToJsonDefinitionParams
- Lean.instToJsonString
- Lean.instToJsonUSize
- Lean.Lsp.instToJsonWorkspaceSymbolParams
- Lean.Lsp.instToJsonMarkupKind
- Lean.Lsp.instToJsonFileEvent
- Lean.Lsp.instToJsonHover
- Lean.Lsp.instToJsonDidOpenTextDocumentParams
- Lean.Lsp.instToJsonSemanticTokens
- Lean.instToJsonInt
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
- Lean.instFromJsonArray = { fromJson? := fun x => match x with | Lean.Json.arr a => Array.mapM Lean.fromJson? a | j => throw (toString "expected JSON array, got '" ++ toString j ++ toString "'") }
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 (max u_1 u_2)}
{β : Type (max u_1 u_2)}
[inst : Lean.FromJson α]
[inst : Lean.FromJson β]
:
Lean.FromJson (α × β)
Equations
- Lean.instFromJsonProd = { fromJson? := fun x => match x with | Lean.Json.arr #[ja, jb] => do let a ← Lean.fromJson? ja let b ← Lean.fromJson? jb pure (a, b) | j => throw (toString "expected pair, got '" ++ toString j ++ toString "'") }
instance
Lean.instToJsonProd
{α : Type u_1}
{β : Type u_2}
[inst : Lean.ToJson α]
[inst : 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
- Lean.instFromJsonName = { fromJson? := fun j => do let s ← Lean.Json.getStr? j if (s == "[anonymous]") = true then pure Lean.Name.anonymous else do let discr ← pure (Lean.Syntax.decodeNameLit ("`" ++ s)) match discr with | some n => pure n | x => throw (toString "expected a `Name`, got '" ++ toString j ++ toString "'") }
Equations
- Lean.instToJsonName = { toJson := fun n => Lean.Json.str (toString n) }
Equations
- Lean.bignumFromJson? j = do let s ← Lean.Json.getStr? j let discr ← pure (Lean.Syntax.decodeNatLitVal? s) match discr with | some v => pure v | x => throw (toString "expected a string-encoded number, got '" ++ toString j ++ toString "'")
Equations
Equations
- Lean.instFromJsonUSize = { fromJson? := fun j => do let n ← Lean.bignumFromJson? j let _do_jp : PUnit → Except String USize := fun y => pure (USize.ofNat n) if n ≥ USize.size then do let y ← throw "value '{j}' is too large for `USize`" _do_jp y else do let y ← pure PUnit.unit _do_jp y }
Equations
- Lean.instToJsonUSize = { toJson := fun v => Lean.bignumToJson (USize.toNat v) }
Equations
- Lean.instFromJsonUInt64 = { fromJson? := fun j => do let n ← Lean.bignumFromJson? j let _do_jp : PUnit → Except String UInt64 := fun y => pure (UInt64.ofNat n) if n ≥ UInt64.size then do let y ← throw "value '{j}' is too large for `UInt64`" _do_jp y else do let y ← pure PUnit.unit _do_jp y }
Equations
- Lean.instToJsonUInt64 = { toJson := fun v => Lean.bignumToJson (UInt64.toNat v) }
Equations
- Lean.Json.instFromJsonStructured = { fromJson? := fun x => match x with | Lean.Json.arr a => pure (Lean.Json.Structured.arr a) | Lean.Json.obj o => pure (Lean.Json.Structured.obj o) | j => throw (toString "expected structured object, got '" ++ toString j ++ toString "'") }
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
Equations
- Lean.Json.getObjValAs? j α k = Lean.fromJson? (Lean.Json.getObjValD j k)
Equations
- Lean.Json.opt k x = match x with | none => [] | some o => [(k, Lean.toJson o)]
def
Lean.Json.parseTagged
(json : Lean.Json)
(tag : String)
(nFields : Nat)
(fieldNames? : Option (Array Lean.Name))
:
Equations
- Lean.Json.parseTagged json tag nFields fieldNames? = if (nFields == 0) = true then match Lean.Json.getStr? json with | Except.ok s => if (s == tag) = true then Except.ok #[] else throw (toString "incorrect tag: " ++ toString s ++ toString " ≟ " ++ toString tag ++ toString "") | Except.error err => Except.error err else match Lean.Json.getObjVal? json tag with | Except.ok payload => match fieldNames? with | some fieldNames => let fields := #[]; do let r ← forIn fieldNames fields fun fieldName r => let fields := r; do let a ← Lean.Json.getObjVal? payload (Lean.Name.getString! fieldName) let fields : Array Lean.Json := Array.push fields a pure PUnit.unit pure (ForInStep.yield fields) let x : Array Lean.Json := r let fields : Array Lean.Json := x Except.ok fields | none => if (nFields == 1) = true then Except.ok #[payload] else match Lean.Json.getArr? payload with | Except.ok fields => if (Array.size fields == nFields) = true then Except.ok fields else Except.error (toString "incorrect number of fields: " ++ toString (Array.size fields) ++ toString " ≟ " ++ toString nFields ++ toString "") | Except.error err => Except.error err | Except.error err => Except.error err