Assuming that caring for efficiency is really important and not a premature optimization, you should optimize for the case that is most common; I think that even in Haskell, this means that you want to have True,True,True vertices on top.
In fact, in this case, if x == 10 or x == 20 you do not need to perform other tests - you do not even need to build thunk by calculating them; and the compiler cannot know (without profile-based optimization) which is the most traffic code that will be executed the most, while you should have a reasonable guess (in general, you need to profile to make sure).
So what you want is something like the following (untested):
case x of 10 -> stuff () 20 -> stuff () _ -> case ((x > -10) && (x < 20),x /= 9,(x `mod` 2) == 0) of (False,_,_) -> error "Not in range" (_,False,_) -> error "Must not be 9" (_,_,False) -> error "Must be even" _ -> error "Error Message"
Disclaimer: I did not check what happens with this code and the original after all the optimizations.
source share