I am trying to replicate the following requirements/code in Haskell
Pseudo-Code (the actual evaluations are much more complicated):
if (x == 1)
doX()
else if (y == 1)
doY()
else if (z == 1)
doZ()
else
doSomethingElse()
Right now I have this as WHEN statements for each, but that doesn't give me an ELSE, so I have
when (x == 1) $ do doX
when (y == 1) $ do doY
when (z == 1) $ do doZ
But then how do I manage my else?
if...then...else... expressions, so the pseudocode is only missingthens to be legal Haskell. (But watch out for indentation if usingif then elsetogether withdo.)[doX, doY, doZ] !! findIndex (==1) [x, y, z]