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

Add the drop combinator #3

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

drewolson
Copy link
Contributor

This is syntactic sugar for cases where you want to throw away the result of a monadic do. You can now write use <- drop(p) rather than use _ <- do(p).

@RyanBrewer317
Copy link
Owner

Hey, thanks for taking the time to contribute!!

I like your drop combinator, I come up against use _ <- do(...) quite often haha.

Would you consider changing its implementation to use seq instead? It's unlikely we'll change seq, but if we did want to improve its behavior somehow then it'd be nice if drop got that improvement as well. And I've heard gleam is getting a function-inlining optimization at some point soonish, so it wouldn't be much slower.

This is syntactic sugar for cases where you want to throw away the
result of a monadic do. You can now write `use <- drop(p)` rather than
`use _ <- do(p)`.
@drewolson
Copy link
Contributor Author

I pushed an update to use seq. I've also (I think) fixed the github action by changing the gleam check command. Let me know if you'd like me to split these commits.

@RyanBrewer317 RyanBrewer317 merged commit b22db7c into RyanBrewer317:master Dec 12, 2024
@RyanBrewer317
Copy link
Owner

I don't fully understand the github action change but I'll accept it because I don't care too much about that formatting check.

Using lazy there was very smart, I didn't think of that! Great work.

Thank you for taking the time to contribute!

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