I wanna match many conditions with one expression in Haskell pattern matching.
for example,
data Message = HELLO | HI | GOODBYE | BYE
greeting x = case x of
HELLO or HI -> "hello"
GOODBYE or BYE -> "bye"
But I can’t find how to do this.
sorry for my poor english.
thank you.
Try guards. Ex,
Note you’ll have to derive an
Eqinstance for your data type. Check out the relevant section of Learn you a Haskell.