feat(bindings/haskell): add more api#6264
Merged
Xuanwo merged 12 commits intoapache:mainfrom Jun 10, 2025
Merged
Conversation
silver-ymz
reviewed
Jun 9, 2025
silver-ymz
reviewed
Jun 9, 2025
There was a problem hiding this comment.
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, updateBasicTest.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.useAsCStringLenand theByteStringtype aren’t in scope here. You should importData.ByteString (ByteString)andqualified Data.ByteString as BS, or switch to usingBS8.useAsCStringLenif 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`.
silver-ymz
reviewed
Jun 9, 2025
asukaminato0721
commented
Jun 9, 2025
silver-ymz
reviewed
Jun 9, 2025
silver-ymz
approved these changes
Jun 10, 2025
Member
silver-ymz
left a comment
There was a problem hiding this comment.
LGTM, thanks for your contribution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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?