Skip to content

feat(bindings/haskell): support list and scan#2527

Merged
Xuanwo merged 3 commits intomainfrom
feat/haskell-list-scan
Jun 25, 2023
Merged

feat(bindings/haskell): support list and scan#2527
Xuanwo merged 3 commits intomainfrom
feat/haskell-list-scan

Conversation

@silver-ymz
Copy link
Copy Markdown
Member

@silver-ymz silver-ymz commented Jun 25, 2023

Update:

  • export list and scan
  • add tests for copy, rename, list, scan
  • fix error of trailling \0 in leak_str
  • refactor OpMonad from custom type to type synonym in order to provide more available ways

I imitate DirStream in unix library to design Lister API. However, it doesn't seem very native and useful. I havn't came up with other solutions about it yet. Maybe we can improve it in the future.

Signed-off-by: silver-ymz <yinmingzhuo@gmail.com>
@Xuanwo
Copy link
Copy Markdown
Member

Xuanwo commented Jun 25, 2023

I imitate DirStream in unix library to design Lister API. However, it doesn't seem very native and useful. I havn't came up with other solutions about it yet. Maybe we can improve it in the future.

How will haskell handle similiar works?

@silver-ymz
Copy link
Copy Markdown
Member Author

These are unix library API for DirStream.

openDirStream :: RawFilePath -> IO DirStream
readDirStream :: DirStream -> IO RawFilePath

It seems only to provide an iterator and next function.

These are the APIs I exported.

listOpRaw :: Operator -> String -> IO (Either OpenDALError Lister)
nextLister :: Lister -> IO (Either OpenDALError (Maybe String))
allLister :: Lister -> IO (Either OpenDALError [String])

list operation will return a Lister and we provide next and all operation for it.

The API I'm expecting is like ListT in pipe library. With it, users can use all standard library utilities like map, filter, etc. I may need to spend more time researching it.

@Xuanwo
Copy link
Copy Markdown
Member

Xuanwo commented Jun 25, 2023

we provide next and all operation for it.

Provide all on Lister is wrong since the Lister could be very large (more than 1M objects). It's by design that only has a next function.

Signed-off-by: silver-ymz <yinmingzhuo@gmail.com>
@github-actions github-actions Bot added the releases-note/feat The PR implements a new feature or has a title that begins with "feat" label Jun 25, 2023
Signed-off-by: silver-ymz <yinmingzhuo@gmail.com>
@silver-ymz
Copy link
Copy Markdown
Member Author

I have removed all operation. Could you review again?

Copy link
Copy Markdown
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

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

Thanks!

@Xuanwo Xuanwo merged commit b78a82e into main Jun 25, 2023
@Xuanwo Xuanwo deleted the feat/haskell-list-scan branch June 25, 2023 07:48
@PsiACE PsiACE mentioned this pull request Jun 27, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

releases-note/feat The PR implements a new feature or has a title that begins with "feat"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants