Scala traits and implicit conversion confusion?

Functions can't be defined at the top level. Put myTraitToString in a (companion, if you like) object: object myTrait { implicit def myTraitToString(input : myTrait) : String = input. ToString } And then bring it into scope: import myTrait Whenever myTraitToString is in scope -- i.e.

When you could call it without any dots -- it will be applied implicitly.

Functions can't be defined at the top level. Put myTraitToString in a (companion, if you like) object: object myTrait { implicit def myTraitToString(input : myTrait) : String = input. ToString } And then bring it into scope: import myTrait.

_ Whenever myTraitToString is in scope -- i.e. When you could call it without any dots -- it will be applied implicitly.

Awesome, that did the trick! – pr1001 Apr 17 '10 at 23:19.

When you could call it without any dots -- it will be applied implicitly.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions