-
Notifications
You must be signed in to change notification settings - Fork 707
feat(bindings/haskell): add more api #6264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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, 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
left a comment
There was a problem hiding this 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
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?