-- | Given an array length, check it is not zero.
checkNotEmpty :: String -> Int -> a -> a
checkNotEmpty loc n v
  | debug     
  = if n /= 0 
        then v 
        else error $ loc ++ ": Empty array"

  | otherwise = v
checkNotEmpty :: String -> Int -> a -> a
checkNotEmpty loc n v
  | debug     
  = if n /= 0 
        then v 
        else error $ loc ++ ": Empty array"

  | otherwise = v
checkNotEmpty loc n v
  | debug     
  = if n /= 0 
        then v 
        else error $ loc ++ ": Empty array"

  | otherwise = v