Skip to content

remove IO.unit - #1041

Merged
fwbrasil merged 6 commits into
mainfrom
remove-io-unit
Jan 21, 2025
Merged

fwbrasil merged 6 commits into
mainfrom
remove-io-unit

Conversation

@fwbrasil

Copy link
Copy Markdown
Collaborator

This method was introduced before we had the Kyo companion object. It doesn't make much sense since I'd expect it to return a suspended computation given the pending IO.

* @return
* A unit value wrapped in an IO effect.
*/
inline def unit: Unit < IO = ()

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.

Do you see any value in keeping this with a suspension? val unit = IO(())? I agree the current value is perhaps not there.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Not really. All the current uses don't require suspension for example. I think if we keep it with suspension, we'll likely see code that doesn't require suspension being suspended.

*/
inline def pure[A, S](inline v: A): A < S = v

inline def unit[S]: Unit < S = ()

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.

Can you add a scaladoc and note this doesn't suspend?

@fwbrasil
fwbrasil merged commit e2789eb into main Jan 21, 2025
@fwbrasil
fwbrasil deleted the remove-io-unit branch January 21, 2025 20:22
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.

2 participants