Skip to content
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

Unify Array APIs #2391

Merged
merged 2 commits into from
Jul 19, 2023
Merged

Unify Array APIs #2391

merged 2 commits into from
Jul 19, 2023

Conversation

rnjtranjan
Copy link
Collaborator

No description provided.

@rnjtranjan
Copy link
Collaborator Author

Fixes:#2334

@rnjtranjan rnjtranjan changed the title Rename fromBytes and fromChunks Unify Array APIs Apr 13, 2023
core/src/Streamly/Internal/Data/Array/Generic.hs Outdated Show resolved Hide resolved
core/src/Streamly/Internal/Data/Array/Generic/Mut/Type.hs Outdated Show resolved Hide resolved
toStreamD :: MonadIO m => MutArray a -> D.Stream m a
toStreamD arr@MutArray{..} =
{-# INLINE_NORMAL read #-}
read :: MonadIO m => MutArray a -> D.Stream m a
Copy link
Member

Choose a reason for hiding this comment

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

There should not be a MonadIO constraint. See the Data.Array API.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it uses "getIndexUnsafe" which requires a MonadIO constraint.

Copy link
Member

Choose a reason for hiding this comment

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

This is a mutable array. This needs to have a MonadIO constraint.

core/src/Streamly/Data/MutArray/Generic.hs Show resolved Hide resolved
core/src/Streamly/Internal/Data/Array/Generic/Mut/Type.hs Outdated Show resolved Hide resolved
core/src/Streamly/Internal/FileSystem/File.hs Outdated Show resolved Hide resolved
Comment on lines +645 to +651
{-# INLINE fromStreamN #-}
fromStreamN :: MonadIO m => Int -> Stream m a -> m (MutArray a)
fromStreamN n = D.fold (writeN n)

{-# INLINE fromStream #-}
fromStream :: MonadIO m => Stream m a -> m (MutArray a)
fromStream = D.fold write
Copy link
Member

Choose a reason for hiding this comment

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

Do we need these? INLINE these definations?

@harendra-kumar harendra-kumar merged commit ad90f17 into master Jul 19, 2023
12 of 15 checks passed
@harendra-kumar harendra-kumar deleted the unify_Arrays_API branch January 25, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants