Skip to content

Commit d585d5b

Browse files
committed
feat: ToJson and FromJson for String.Slice
1 parent 62f2f92 commit d585d5b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Lean/Data/Json/FromToJson/Basic.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ instance : FromJson Int := ⟨Json.getInt?⟩
4646
instance : ToJson Int := ⟨fun n => Json.num n⟩
4747
instance : FromJson String := ⟨Json.getStr?⟩
4848
instance : ToJson String := ⟨fun s => s⟩
49+
instance : FromJson String.Slice := ⟨Except.map String.toSlice ∘ Json.getStr?⟩
50+
instance : ToJson String.Slice := ⟨fun s => s.copy⟩
4951

5052
instance : FromJson System.FilePath := ⟨fun j => System.FilePath.mk <$> Json.getStr? j⟩
5153
instance : ToJson System.FilePath := ⟨fun p => p.toString⟩

0 commit comments

Comments
 (0)