
17 May
2019
17 May
'19
9:37 a.m.
On Thu, May 16, 2019 at 10:21:14PM -0500, Nathan Bloomfield wrote:
This is a good opportunity to use case syntax. You can also case on tuples, like this:
``` foo a b = case (a,b) of (A1,B1) -> fun1 (A1,B2) -> fun2 (A1,B3) -> fun3 (A1,_) -> fun4 <- this is probably not necessary anymore, unless you expect Rule2 to get more constructors. (A2,B1) -> fun5 ... ```
In fact, and this is veering somewhat off-topic, but I would strongly recommend *not* making a default match `(A1,_)` because then you will get an explicit warning if indeed `Rule2` gets more constructors.