I was trying to nest guards which check for more than two conditions like so:
f :: Int -> Int
f i
| bool1
| bool2 = a
| bool3 = a2
| otherwise = a3
| bool4
| bool5 = a4
| bool6 = a5
| otherwise = a6
| bool8
...
| otherwise = an
which gives me a parse error.
Is the proper way to do this
to flatten the guards with && or
to implement a function like so:
multiIf :: [Bool] -> [a] -> a
multiIf (x:xs) (l:ls) = if x then l else multiIf xs ls
multiIf _ _ = undefined
Or is there another method?