E141: Missing Type Parameter In Type App
This error occurs when a type constructor that takes type parameters is used without providing all required type arguments in a context where a fully applied type is expected.
This typically happens when a parameterized type like Container[T] is passed to a method expecting a simple type T, but Container is passed without its type argument. The type constructor needs to be fully applied with concrete types to match the expected kind.
Example
object Example:
class Container[T]
def process[T] = ???
def test(): Unit =
process[Container]
Error
-- [E141] Type Error: example.scala:7:12 ---------------------------------------
7 | process[Container]
| ^^^^^^^^^
| Missing type parameter for Example.Container
|-----------------------------------------------------------------------------
| Explanation (enabled by `-explain`)
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| A fully applied type is expected but Example.Container takes 1 parameter
-----------------------------------------------------------------------------
Solution
// Provide the missing type parameter
object Example:
class Container[T]
def process[T] = ???
def test(): Unit =
process[Container[Int]]
// Alternative: If higher-kinded type is intended, change the method signature
object Example:
class Container[T]
def process[F[_]] = ???
def test(): Unit =
process[Container]
In this article