Sto cercando di verificare se una certa pagina web è utilizzando la seguente funzione:Scala Liftweb - tipo di pattern non è compatibile con il tipo previsto
import net.liftweb.common.{Failure, Empty, Full, Box} // 1
// 2
def isAlive = { // 3
httpClient.getAsString("http://www.google.com", Nil) match { // 4
case f : Full[String] => true // 5
case f : Failure => false // 6
case Empty => false // 7
} // 8
} // 9
Il tipo restituito getAsString funzione è net.liftweb.common.Box[String]
La funzione funziona bene, ma il mio problema è che quando sostituisco linea 6 con questa linea:
case Failure => false // 6
sto ottenendo l'errore:
012.error: pattern type is incompatible with expected type;
found : object net.liftweb.common.Failure
required: net.liftweb.common.Box[String]
case Failure => false
(stessa cosa vale per la linea 5)
Perché succede? Perché devo usare una variabile per la partita e non posso fare la partita solo in base al tipo?