ref: 38a875c05a009fdd298e7a93086654c8b78b2f63
dir: /test/traitimpl.myr/
use std
trait frobable @a =
frob : (val : @a -> @a)
;;
impl frobable int =
frob = {val
-> val * 2
}
;;
impl frobable int16 =
frob = {val
-> val * 4
}
;;
impl frobable byte[:] =
frob = {val
-> val[:4]
}
;;
generic foo = {x : @a::frobable
-> frob(x)
}
const main = {
var a, b, c
a = foo(123)
b = foo(11 castto(int16))
c = frob("meeeeeeh")
std.put("%i,%w,%s\n", a, b, c)
}