Reputation: 2216
The error it yields is:
Funct.scala:5: 'val' expected but identifier found.
[error] class Funct[In,Out](function: In => Out, description: String, implicit m: Manifest[In => Out]) {
and the code in question is:
import scala.reflect.Manifest;
class Funct[In,Out](function: In => Out, description: String, implicit m: Manifest[In => Out]) {
def isType[K](implicit man: Manifest[K]) = {
m <:< man
}
def Apply(input: In): Out = {
function.Apply(input)
}
def toString() = {
description + m
}
}
I simply do not see what the problem is.
Upvotes: 0
Views: 160
Reputation: 51109
function.Apply(input)
should be function.apply(input)
or just function(input)
, but seriously, just use IntelliJ or Eclipse and they'll tell you these things immediately.
Upvotes: 3
Reputation: 1765
There are a few problems you should be able to figure out, but the message is indeed a bit confusing.
The issue here is that the implicit
keyword must mark the whole parameter group and not just individual parameters. Try:
class Funct[In,Out](function: In => Out, description: String)(implicit m: Manifest[In => Out])
Upvotes: 7