-- | Compare two sets of Futhark values for equality.  Shapes and
-- types must also match.
compareValues :: [Value] -> [Value] -> Maybe Mismatch
compareValues got expected
  | n /= m = Just $ ValueCountMismatch n m
  | otherwise = case catMaybes $ zipWith3 compareValue [0..] got expected of
    e : _ -> Just e
    []    -> Nothing
  where n = length got
        m = length expected
compareValues :: [Value] -> [Value] -> Maybe Mismatch
compareValues got expected
  | n /= m = Just $ ValueCountMismatch n m
  | otherwise = case catMaybes $ zipWith3 compareValue [0..] got expected of
    e : _ -> Just e
    []    -> Nothing
  where n = length got
        m = length expected
compareValues got expected
  | n /= m = Just $ ValueCountMismatch n m
  | otherwise = case catMaybes $ zipWith3 compareValue [0..] got expected of
    e : _ -> Just e
    []    -> Nothing
  where n = length got
        m = length expected