Skip to content

Implement Chan, QSem and QSemN #211

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

bolt12
Copy link
Contributor

@bolt12 bolt12 commented May 6, 2025

Closes #128

Comment on lines +819 to +822
getChanContents ch = do
x <- readChan ch
xs <- getChanContents ch
return (x:xs)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it work without unsafeInterleaveIO? Could you add some tests?

writeChan = IO.writeChan
readChan = IO.readChan
dupChan = IO.dupChan
getChanContents = IO.getChanContents
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
getChanContents = IO.getChanContents
getChanContents = IO.getChanContents
writeList2Chan = IO.writeList2Chan

@@ -2,6 +2,7 @@

## next version

- Implements `MonadChan`, `MonadQSem` and `MonadQSemN` instances.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- Implements `MonadChan`, `MonadQSem` and `MonadQSemN` instances.
- Added `MonadChan`, `MonadQSem` and `MonadQSemN` type classes and their instances.

Comment on lines +872 to +873
putMVar m r')
signalQSem (QSem m) =
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's add some space between definitions

Suggested change
putMVar m r')
signalQSem (QSem m) =
putMVar m r')
signalQSem (QSem m) =

Comment on lines +913 to +915
unit <- modifyMVar m $ \(i,a1,a2) -> loop (sz0 + i) a1 a2

evaluate unit
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
unit <- modifyMVar m $ \(i,a1,a2) -> loop (sz0 + i) a1 a2
evaluate unit
unit <- modifyMVar m $ \(i,a1,a2) -> loop (sz0 + i) a1 a2
evaluate unit

@@ -6,6 +6,7 @@

### Breaking changes

- Added `MonadChan`, `MonadQSem` and `MonadQSemN` classes.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- Added `MonadChan`, `MonadQSem` and `MonadQSemN` classes.
* Added `MonadChan`, `MonadQSem` and `MonadQSemN` classes.

😁

@coot
Copy link
Collaborator

coot commented May 15, 2025

I am planning to release io-classes-1.8 (#213), it would be nice to include your two PRs.

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.

Add Chan, QSem and QSenN
2 participants