The following trait Parser[+T] is a trait that extends a function that accepts an Input and returns a Result[T].
trait Parser[+T] extends (Input => Result[T])
Is that correct?
Right.
Input => Result[T] is a shortcut for Function1[Input, Result[T]].
It has an abstrat method
def apply(v1: Input) : Result[T]
which when defined will be the actual function implementation.
Scala syntax allows methods called apply to be called silently, that is for some expression e, e(x1, ... xn) will be translated to e.apply(x1, ... xn)
Almost. It extends Function[Input, Result[T]] - the type of function that takes Input as argument and returns Result[T] (not T) as result. Result[T] carries information about a successful parse into a T or an error that occurs during parse.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With