getCommentsInfo :: Monad m => [CommentID] -> RedditT m CommentListing
getCommentsInfo cs =
  if null $ drop 100 cs
    then do
      res <- runRoute $ Route.commentsInfo cs
      case res of
        Listing _ _ comments | sameLength comments cs ->
          return res
        _ -> failWith $ APIError InvalidResponseError
    else failWith $ APIError TooManyRequests
  where
    sameLength (_:xs) (_:ys) = sameLength xs ys
    sameLength [] [] = True
    sameLength _ _ = False

-- | Edit a comment.
getCommentsInfo :: Monad m => [CommentID] -> RedditT m CommentListing
getCommentsInfo cs =
  if null $ drop 100 cs
    then do
      res <- runRoute $ Route.commentsInfo cs
      case res of
        Listing _ _ comments | sameLength comments cs ->
          return res
        _ -> failWith $ APIError InvalidResponseError
    else failWith $ APIError TooManyRequests
  where
    sameLength (_:xs) (_:ys) = sameLength xs ys
    sameLength [] [] = True
    sameLength _ _ = False

-- | Edit a comment.
getCommentsInfo cs =
  if null $ drop 100 cs
    then do
      res <- runRoute $ Route.commentsInfo cs
      case res of
        Listing _ _ comments | sameLength comments cs ->
          return res
        _ -> failWith $ APIError InvalidResponseError
    else failWith $ APIError TooManyRequests
  where
    sameLength (_:xs) (_:ys) = sameLength xs ys
    sameLength [] [] = True
    sameLength _ _ = False

-- | Edit a comment.