[Haskell-cafe] How to express a logic matrix clearly?
Magicloud Magiclouds
magicloud.magiclouds at gmail.com
Fri May 17 03:12:43 UTC 2019
Hi,
I have trouble describing this clearly. Let me show code directly.
data Rule1 = A1 | A2 | A3
data Rule2 = B1 | B2 | B3
foo a b =
if a == A1
then if b == B1
then fun1
else if b == B2
then fun2
else if b == B3
then fun3
else fun4
...
Basically, Rule1 and Rule2 compose a matrix, for each case of Rule1
and Rule2, I need to do different things. Above is already long and
not quite clear, and it is far from complete.
So my question is, is there a way/lib that I can make this clear to
read/understand?
More information about the Haskell-Cafe
mailing list