{-|
 List file names at path. The HDFS will return full qualified file names including protocol, host and port.
 For simplicity, these can be used for opening files etc without stripping, but will access the referenced
 host which is sometimes undesirable. Constructing the prototol part should not be done manually, since port and hostname are local knowledge
 of the thrift server, strictly speaking.
|-}
hdfsListFiles :: Config -> Path -> IO [Location]
hdfsListFiles config path = do
  putStrLn $ "looking at " ++ path
  res <- listStatus config path
  return $ map convertFileStatusToLocation res
    where convertFileStatusToLocation = uncurry Location . splitLocation . TL.unpack . Types.fileStatus_path

{-|
 Read file content of path
  - throws an exception if path does not point at a regular file.
|-}
hdfsListFiles :: Config -> Path -> IO [Location]
hdfsListFiles config path = do
  putStrLn $ "looking at " ++ path
  res <- listStatus config path
  return $ map convertFileStatusToLocation res
    where convertFileStatusToLocation = uncurry Location . splitLocation . TL.unpack . Types.fileStatus_path

{-|
 Read file content of path
  - throws an exception if path does not point at a regular file.
|-}
hdfsListFiles config path = do
  putStrLn $ "looking at " ++ path
  res <- listStatus config path
  return $ map convertFileStatusToLocation res
    where convertFileStatusToLocation = uncurry Location . splitLocation . TL.unpack . Types.fileStatus_path

{-|
 Read file content of path
  - throws an exception if path does not point at a regular file.
|-}