shithub: mc

ref: 976f82e68f9746bae7732eb762e9e8b68c84c805
dir: /test/traitimpl.myr/

View raw version
use std

trait frobable @a =
	frob	: (val : @a -> @a)
;;

impl frobable int =
	frob = {val
		-> val * 2
	}
;;

impl frobable int16 =
	frob = {val
		-> val * 4
	}
;;

generic foo = {x : @a::frobable
	-> frob(x)
}

const main = {
	var a, b
	a = foo(123)
	b = foo(11 castto(int16))
	std.put("%i,%w\n", a, b)
}