f(x:y)=null y||all((0==).sum.zipWith(*)x)y&&f y main = do putStrLn $ show $ f [[1]] -- True putStrLn $ show $ f [[1,-1],[-1,1]] -- False putStrLn $ show $ f [[1,1],[1,-1]] -- True putStrLn $ show $ f [[1,1,1,1],[1,-1,1,-1],[1,1,-1,-1],[1,-1,-1,1]] -- True putStrLn $ show $ f [[1,1,1,1],[1,-1,1,-1],[1,-1,-1,1],[1,-1,-1,1]] -- False putStrLn $ show $ f [[1,-1,1,-1],[-1,1,-1,1],[1,-1,1,-1],[-1,1,-1,1]] -- False