49

What does [A : Manifest : WireFormat] mean in the following code? It's from com.nicta.scoobi.TextInput (available on github). It doesn't seem to be any of the usual type bounds.

 def fromDelimitedTextFile[A : Manifest : WireFormat] (path: String, sep: String = "\t") (extractFn: PartialFunction[List[String], A]) : DList[A] = { val lines = fromTextFile(path) lines.flatMap { line => val fields = line.split(sep).toList if (extractFn.isDefinedAt(fields)) List(extractFn(fields)) else Nil } } 

Where can I find more information about this topic?

1 Answer 1

60

This is called a context bound. They are syntactic sugar for an implicit parameter list:

def meth[A : ContextBound1 : ContextBoundN](a: A) // ==> def meth[A](a: A)(implicit evidence: ContextBound1[A], ContextBoundN[A]) 

If there are multiple context bounds from 1 to N, they are all translated into the same parameter list. See this question for a more detailed explanation about how they work and for what they are useful.

To find such symbols it is useful to read the StackOverflow Scala Tutorial.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.