Based on the discussion at https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/for.2C.20unexpected.20need.20for.20type.20ascription/near/269083574 The consensus seemed to be that "auto pure" is more confusing than its worth.
8 lines
175 B
Text
8 lines
175 B
Text
import Lean
|
||
open Lean
|
||
|
||
def encodeDecode [ToJson α] [FromJson α] (x : α) : Except String α := do
|
||
let json := toJson x
|
||
fromJson? json
|
||
|
||
#eval encodeDecode Name.anonymous
|