mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-03 18:29:00 +00:00
Add Show
trait
This commit is contained in:
parent
4f6fbb50d0
commit
e55ab8c027
4 changed files with 32 additions and 20 deletions
|
@ -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])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue