Skip to content

Conversation

@coot
Copy link
Collaborator

@coot coot commented Jun 29, 2022

No description provided.

coot and others added 2 commits June 29, 2022 08:51
Deriving a semigroup instance via 'Alt' for 'IO' relies on 'IO'
'Alternative' instance, which is not what we want.  We want 'race`
semantics instead.

The drawback is that one needs to specify the
'Semigroup (FirstToFinish m a)' constraint, when 'm' is abstract, as in
the tests.


instance Semigroup (FirstToFinish IO a) where
FirstToFinish a <> FirstToFinish b = FirstToFinish $ either id id <$> race a b
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can use similar approach to LastToFinish.

, MonadTime m
, MonadTimer m
, MonadMask m
, forall a stm. stm ~ STM m => Semigroup (FirstToFinish stm a)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Use a type alias for this constraint if possible.

@coot coot removed the networking label Dec 18, 2023
Copy link
Contributor

@bolt12 bolt12 left a comment

Choose a reason for hiding this comment

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

What's the difference between LastToFinish and LastToFinishM?

@coot
Copy link
Collaborator Author

coot commented Oct 25, 2024

The difference is explained here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants