title: Is there any way to set a default value to generic type variable in Scala?
body: <p>I want to set a default value to variable. But my Scala compiler says:</p>
  
  <pre><code>Error:(20, 16) unbound placeholder parameter
      val p: T = _
                 ^
  </code></pre>
  
  <p>Here is the code.</p>
  
  <pre><code>object InverseFunctionsExample extends App {
  
    type D = Double
  
    def f(x: D): D = 5 * x + 10
    def g(x: D): D = 0.2 * x - 2
  
    printMessage(isInversible(f, g))
  
    def printMessage(inv: Boolean): Unit = {
      if (inv) print("YES!") else print("NOPE!")
    }
  
    def isInversible[T](f: (T) =&gt; T, g: (T) =&gt; T): Boolean = {
      val p: T = _
      if (f(p) == g(p))
        true
      else
        false
    }
  }
  </code></pre>
  
  <p>Is it possible to initialize a <code>val p</code> with default value somehow?</p>