Skip to content

Conversation

@asukaminato0721
Copy link
Contributor

Which issue does this PR close?

part of haskell binding (currently no issue)

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@asukaminato0721 asukaminato0721 changed the title add more api feat(bindings/haskell): add more api Jun 5, 2025
@asukaminato0721 asukaminato0721 marked this pull request as ready for review June 6, 2025 09:03
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. releases-note/feat The PR implements a new feature or has a title that begins with "feat" labels Jun 6, 2025
@silver-ymz silver-ymz requested review from Xuanwo and Copilot June 9, 2025 06:26

This comment was marked as outdated.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Enhance Haskell bindings with writer, append, operator info, and remove-all APIs, and back them with new tests.

  • Introduce new blocking FFI functions (append, writer, writer_append, operator_info, remove_all) in Rust and expose them in the Haskell FFI.
  • Add high-level Haskell bindings (Writer, WriterOption, defaultWriterOption, appendWriterOption, writerOpRaw, writerWrite, writerClose, operatorInfoRaw, removeAllOpRaw).
  • Expand the test suite with WriterTest.hs, ErrorTest.hs, PerformanceTest.hs, update BasicTest.hs, Spec.hs, and the cabal file.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
bindings/haskell/src/lib.rs Implement new FFI functions for append, writer creation, operator info, and remove-all
bindings/haskell/haskell-src/OpenDAL.hs Expose the Writer API, options, and high-level functions to Haskell users
bindings/haskell/haskell-src/OpenDAL/FFI.hs Add raw imports for the new FFI functions and define RawWriter
bindings/haskell/opendal.cabal Register the new test modules in the test suite
bindings/haskell/test/WriterTest.hs Add writer tests (sequential, large, empty, binary, append scenarios)
bindings/haskell/test/ErrorTest.hs Add error-handling tests for read, stat, delete, copy, rename, list, config, monad
bindings/haskell/test/PerformanceTest.hs Add performance benchmarks for bulk, writer vs direct write, large file, concurrency
bindings/haskell/test/BasicTest.hs Extend basic tests to cover writer, append, lister, copy/rename, removeAll, info
bindings/haskell/test/Spec.hs Register the new test groups in the overall suite
Comments suppressed due to low confidence (1)

bindings/haskell/haskell-src/OpenDAL.hs:625

  • BS.useAsCStringLen and the ByteString type aren’t in scope here. You should import Data.ByteString (ByteString) and qualified Data.ByteString as BS, or switch to using BS8.useAsCStringLen if you prefer the Char8 variant.
BS.useAsCStringLen byte $ \(cByte, len) ->

- Introduced `WriterOption` data type to specify write behavior (overwrite or append).
- Updated `writerOpRaw` function to accept `WriterOption` for creating writers.
- Replaced instances of `newWriter` and `newWriterAppend` with `writerOpRaw` in tests to utilize the new options.
- Added default and append writer options for easier usage.
…usage in tests. Updated tests to demonstrate writing to files using the new writer functionality, ensuring compatibility with existing operations.
- Introduced `parseString` function to convert `CString` to `String`, improving memory management by freeing the original `CString`.
- Updated `operatorInfoRaw` to utilize `parseString` instead of `peekCString`.
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels Jun 10, 2025
Copy link
Member

@silver-ymz silver-ymz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for your contribution

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 10, 2025
@Xuanwo Xuanwo merged commit c2e3a87 into apache:main Jun 10, 2025
35 checks passed
@asukaminato0721 asukaminato0721 deleted the hsk branch June 10, 2025 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bindings/haskell lgtm This PR has been approved by a maintainer releases-note/feat The PR implements a new feature or has a title that begins with "feat" size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants