Add Show trait

This commit is contained in:
Shunsuke Shibayama 2022-10-03 01:02:49 +09:00
parent 4f6fbb50d0
commit e55ab8c027
4 changed files with 32 additions and 20 deletions

View file

@ -3,10 +3,12 @@ assert id(1) == 1
assert id(True) == True
assert id("hello") == "hello"
const|T: Type, C: Type|(c: C): (T -> C) = (_: T,) -> c
assert const(1)(2) == 1
assert const(True)(2) == True
# const|T: Type, C: Type|(c: C): (T -> C) = (x: T,) -> c
# assert const(1)(2) == 1
# assert const(True)(2) == True
print_to_str!|S <: Show|(s: S): Str =
print! s
s.to_str()
discard print_to_str!([1])