2

I'm attempting to pimp TraversableLike using Miles Sabins answer to How do I apply the enrich-my-library pattern to Scala collections? However the compiler doesn't recognise FromRepr, HasElem or implicitConversions

package packMain
import scala.collection.generic.{ CanBuildFrom, FromRepr, HasElem }
import language.implicitConversions

class ImplClasses {}

FromRepr is not a member of scala.collection.generic
HasElem is not a member of scala.collection.generic
not found object language

I've tried using Eclipse Indigo with Scala plug-in 2.02 and 2.9.2 Final and Eclipse 4.2 Juno with Scala plug-in 2.1M2 and 2.10.0M7 Edit:

import language.implicitConversions._ //works in 2.10M7 as gilad hock's comment
import scala.collection.generic.FromRepr._ //object FromRep is not a member of ...
import scala.collection.generic.HasElem._ //object HasElem is not a member of ...
Community
  • 1
  • 1
Rich Oliver
  • 6,001
  • 4
  • 34
  • 57
  • The 2.9.2 one certainly isn't going to work because that was before the change. – Rex Kerr Sep 18 '12 at 17:44
  • 1
    to get the implicitis to work, you need to import them explicitly, and not just the containing package. you can use a wildcard: `import language.implicitConversions._` – gilad hoch Sep 18 '12 at 17:46

1 Answers1

2

to get the implicitis to work, you need to import them explicitly, and not just the containing package. you can use a wildcard: import language.implicitConversions._

EDIT:
as for FromRepr & HasElem, i can't find those in the package. also, after reading Miles Sabin answer on How do I apply the pimp-my-library pattern to Scala collections?, i noticed he said: As of this commit it's a lot easier to... which tells me it's not an integral part of the scala library (yet?), or else, he probably would link to the package definition, and not to a certain commit on github. so you can clone, and build yourself from the source.

Community
  • 1
  • 1
gilad hoch
  • 2,846
  • 2
  • 33
  • 57