Skip to content

Implement Chan, QSem and QSemN#211

Open
bolt12 wants to merge 6 commits into
IntersectMBO:mainfrom
bolt12:bolt12/issue-128
Open

Implement Chan, QSem and QSemN#211
bolt12 wants to merge 6 commits into
IntersectMBO:mainfrom
bolt12:bolt12/issue-128

Conversation

@bolt12
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Comment thread io-sim/CHANGELOG.md

## next version

- Implements `MonadChan`, `MonadQSem` and `MonadQSemN` instances.
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Comment thread io-classes/CHANGELOG.md

### Breaking changes

- Added `MonadChan`, `MonadQSem` and `MonadQSemN` classes.
Copy link
Copy Markdown
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
Copy Markdown
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