@@ -47,9 +47,10 @@ object ErrorHandlingSection
47
47
*/
48
48
def optionMapAssert (res0 : (Option [Employee ]) => Option [String ]): Unit = {
49
49
def lookupByName (name : String ): Option [Employee ] = name match {
50
- case " Joe" => Some (Employee (" Joe" , " Finances" , Some (" Julie" )))
51
- case " Mary" => Some (Employee (" Mary" , " IT" , None ))
52
- case _ => None
50
+ case " Joe" => Some (Employee (" Joe" , " Finances" , Some (" Julie" )))
51
+ case " Mary" => Some (Employee (" Mary" , " IT" , None ))
52
+ case " Izumi" => Some (Employee (" Izumi" , " IT" , Some (" Mary" )))
53
+ case _ => None
53
54
}
54
55
55
56
/**
@@ -244,9 +245,10 @@ object ErrorHandlingSection
244
245
*/
245
246
def eitherMapAssert (res0 : (Either [String , Employee ]) => Either [String , String ]): Unit = {
246
247
def lookupByNameViaEither (name : String ): Either [String , Employee ] = name match {
247
- case " Joe" => Right (Employee (" Joe" , " Finances" , Some (" Julie" )))
248
- case " Mary" => Right (Employee (" Mary" , " IT" , None ))
249
- case _ => Left (" Employee not found" )
248
+ case " Joe" => Right (Employee (" Joe" , " Finances" , Some (" Julie" )))
249
+ case " Mary" => Right (Employee (" Mary" , " IT" , None ))
250
+ case " Izumi" => Right (Employee (" Izumi" , " IT" , Some (" Mary" )))
251
+ case _ => Left (" Employee not found" )
250
252
}
251
253
252
254
def getDepartment : (Either [String , Employee ]) => Either [String , String ] = res0
0 commit comments