I am trying to write a haskell interpeter for different kind of statements. One such is a switch statement. I have done the following as of now but I am stuck and I keep getting redundant pattern matching warning for the ( _ -> if length ) line in the case expression. It is passing the test if the first case expression is the right one but if not the test is failing. Any help appreciated, thanks
 interpret :: Program -> Memory -> Either Err Memory
 interpret [] memory = Right memory
 interpret (SwitchStmt var c:p) memory = let case1 = fst(c!!0)
                                            case2 = snd(c!!0)
                                         in do
                                           val <- evaluate var memory
                                           case val of case1 -> (interpret (case2++p) memory)
                                                        _ -> if length c > 1 then interpret ((SwitchStmt var (tail c)):p) memory
                                                             else interpret p memory 
I have defined data types as such :
data Stmt = SwitchStmt{
                        switchVar  :: Expr,
                        switchCase :: [(Expr,[Stmt])]
                        }