how about:

```scala
for {
 pass <- userCredentials.get(username)
 if (pass == password)
} yield {
  new User(username, password)
}
  
}
```

`Map.get` gives you an `Option[T]`

?