Is there a valid way to do the following in Haskell:
case n of
0 -> doThis
1 -> doThat
2 -> doAnother
3..99 -> doDefault
other than to have 97 lines of "doDefault" ?
case n of
0 -> doThis
1 -> doThat
2 -> doAnother
_ -> doDefault
If you really need a range,
case n of
0 -> doThis
1 -> doThat
2 -> doAnother
x | 3 <= x && x < 100 -> doDefault
_ -> reallyDoDefault
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With