implicits

Other programming languages that support implicits "a la Scala"

Hi. Scala implicits are very powerfull. I'm curious if they are a new/unique feature of Scala, or the concept already existed in other programming languages. Thanks. EDIT: To clarify my question, yes, I'm talking about this concrete implementation. Having "implicit things" all around seemed strange at first, but having used it for a...

[Scala] "can't existentially abstract over parameterized type..."

I was messing around with Scala 2.8 for fun and trying to define a pimp which adds an "as" method to type constructors, allowing to convert from one functor to another (please overlook the fact that I'm not necessarily dealing with functors here). So for instance, you could use it like this: val array:Array[T] val list:List[T] = array.a...

Type classes in Scala

Hi stackoverflow. Having a background in Haskell I am currently trying to get familiar with Scala. I encountered some problems trying to translate a small, extensible expression language from Haskell into Scala. The underlying issue of writing a data type that is extensible with both new data-variants and operations is commonly known a...

Could not find implicit value for parameter ordering

Hi, I get the following error when trying to compile this: Btree.scala:9: error: could not find implicit value for parameter ordering: Ordering[K] abstract class Node[K,V] extends TreeMap[K,V] TreeMap is supposed to accept an implicit Ordering[A] val which I provide. Perhaps the implicit parameter needs to be in object Tester ...

Scala function "implicitly"

I have seen a function named implicitly used in Scala 2.8 examples, what is it and how is it used? Example here: scala> sealed trait Foo[T] { def apply(list : List[T]) : Unit }; object Foo { | implicit def stringImpl = new Foo[String] { | def apply(list : List[String]) = println("String") | }...

Scala compiler says my method is recursive in case when implicits and anonymous class is used

I want to be able to write code like 10 times { doSomething } So I thought I could do that with implicits. When i execute the following code in the Scala REPL it gets defined correctly scala> implicit def intToMyRichInt(count: Int) = { | new { | def times(f: => Unit) = { | 1 to count foreach { _ => f...