I have issue with the return type from a for yield loop ,
i have this method and for some reason , i'm still new to scala... im getting this error and a warning .
this is the method ,
def getPostMD(userID: String,url:String):Future[(Option[String],List[PostMD])]={
val chunk: Future[JsValue] = Methods.getJsonValue(url)
chunk.flatMap(ch => {
val postMd: Option[List[PostMD]] = (ch \ "data").asOpt[List[PostMD]]
for{
relatedPostMd:List[PostMD] <- postMd.get.filter(_.fromID == userID)
nextUrl: Option [String] <-(ch \ "paging" \ "next").asOpt[String]
}yield(nextUrl,relatedPostMd)
}
}
the warning is ,
fruitless type test: a value of type PostMetaData.this.PostMD cannot also be a List[PostMetaData.this.PostMD] (the underlying of List[PostMetaData.this.PostMD])
and the error is ,
scrutinee is incompatible with pattern type; found : Option[String] required: String
What is wrong with my method and what is fruitless type ??
thanks,
miki