I rewrote a series of Haskell functions in Scala and ran into a compilation error that I cannot explain
The error is as follows:
missing parameter type
def group[A](xs: List[A]): List[List[A]] = groupBy((a, b) => a == b, xs)
^
missing parameter type
def group[A](xs: List[A]): List[List[A]] = groupBy((a, b) => a == b, xs)
^
The code is as follows:
object Stuff {
def main(args: Array[String]): Unit = {
val lst = List(1, 1, 1, 1, 2, 2, 2, 3, 4, 4, 5, 6, 7)
println(group(lst))
}
def group[A](xs: List[A]): List[List[A]] = groupBy((a, b) => a == b, xs)
def groupBy[A](fun: (A, A) => Boolean, input: List[A]): List[List[A]] = // stuff
}
I'm not at all sure what is going on here, why it complains about the missing parameter type. As far as I can see, everything is defined
source
share