📜  scala代码示例中的类别理论定律

📅  最后修改于: 2022-03-11 15:00:57.529000             🧑  作者: Mango

代码示例1
scala> :pastesealed trait Breakfast {}case object Eggs extends Breakfast {}case object Oatmeal extends Breakfast {}case object Toast extends Breakfast {}case object Coffee extends Breakfast {}val favoriteBreakfast: Person => Breakfast = {  case John => Eggs  case Mary => Coffee  case Sam  => Coffee}// Exiting paste mode, now interpreting.favoriteBreakfast: Person => Breakfast =