writeL :: FileSystem -> File -> LB.ByteString -> IO Int
writeL (FileSystem fs) (File f) lbs = do
  let fn offset bs = UB.unsafeUseAsCStringLen bs $ \(cstr, len) -> do
      written <- throwErrnoIfMinus1 "writeL" $
                   c_hdfs_write fs f cstr (fromIntegral len)
      return $ offset + fromIntegral written
  foldM fn 0 (LB.toChunks lbs)
writeL :: FileSystem -> File -> LB.ByteString -> IO Int
writeL (FileSystem fs) (File f) lbs = do
  let fn offset bs = UB.unsafeUseAsCStringLen bs $ \(cstr, len) -> do
      written <- throwErrnoIfMinus1 "writeL" $
                   c_hdfs_write fs f cstr (fromIntegral len)
      return $ offset + fromIntegral written
  foldM fn 0 (LB.toChunks lbs)
writeL (FileSystem fs) (File f) lbs = do
  let fn offset bs = UB.unsafeUseAsCStringLen bs $ \(cstr, len) -> do
      written <- throwErrnoIfMinus1 "writeL" $
                   c_hdfs_write fs f cstr (fromIntegral len)
      return $ offset + fromIntegral written
  foldM fn 0 (LB.toChunks lbs)