Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Foo {
- trait TypeClass[X]
- object TypeClass {
- implicit val gimme = new TypeClass[Int]{}
- }
- def foo[X : TypeClass](p: X): Unit = println("yeah " + p)
- }
- // compiles
- val foo = new Foo()
- foo.foo(4)
- //does not compile
- new Foo().foo(4)
- could not find implicit value for evidence parameter of type _1.TypeClass[Int]
- [error] new Foo().foo(4)
- [error]
- val foo = new Foo() // does have a value type foo.type
- new Foo() // doesn't have a value type
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement