📜  在haskell中向数据结构的元素添加类型 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:08.303000             🧑  作者: Mango

代码示例1
data FightMove = Punch Int |
  Kick Int Float |
  Block String

chooseMove :: Int -> FightMove
chooseMove i = if i == 1
  then Punch 3
  Else if i == 2
    then Kick 3 6.5
    else Block “Please Protect Me”