chore: hide weird RpcEncoding behind Nonempty
This commit is contained in:
parent
ed5e0f098c
commit
d36552848c
2 changed files with 5 additions and 3 deletions
|
|
@ -46,8 +46,8 @@ class RpcEncoding (α : Type) (β : outParam Type) where
|
|||
rpcDecode {m : Type → Type} [Monad m] [MonadRpcSession m] : β → ExceptT String m α
|
||||
export RpcEncoding (rpcEncode rpcDecode)
|
||||
|
||||
instance : Inhabited (RpcEncoding α β) where
|
||||
default := { rpcEncode := fun _ => throw "unreachable", rpcDecode := fun _ => throw "unreachable" }
|
||||
instance : Nonempty (RpcEncoding α β) :=
|
||||
⟨{ rpcEncode := fun _ => throw "unreachable", rpcDecode := fun _ => throw "unreachable" }⟩
|
||||
|
||||
instance [FromJson α] [ToJson α] : RpcEncoding α α where
|
||||
rpcEncode := pure
|
||||
|
|
|
|||
|
|
@ -25,7 +25,9 @@ private def deriveWithRefInstance (typeNm : Name) : CommandElabM Bool := do
|
|||
rpcDecode := WithRpcRef.decodeUnsafeAs $typeId:ident $(quote typeNm)
|
||||
|
||||
@[implementedBy unsafeInst]
|
||||
instance : RpcEncoding (WithRpcRef $typeId:ident) Lsp.RpcRef := default
|
||||
opaque inst : RpcEncoding (WithRpcRef $typeId) Lsp.RpcRef
|
||||
|
||||
instance : RpcEncoding (WithRpcRef $typeId) Lsp.RpcRef := inst
|
||||
)
|
||||
elabCommand cmds
|
||||
return true
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue