Improving Slug Generation with Effect.loop in Typescript
Hi. I have a use case where I generate a slug for a blog post, and I want it to be unique, so i generate one, i check if the slug already exist, if it does i regenerate, if not i use it. I use the
The only problem with
Suggestions for improvements welcome.
Effect.loop for it but i wonder it there is a better way? The only problem with
Effect.loop I have is that it does not provide access to the previous results in the loop, so I need to keep track of them myself in previousSlugs. Also, do I need to add the item to the previousSlug in the step or body? And one more thing is that the step part does not take an Effect, so I had to use sync on it. It's not ideal...Suggestions for improvements welcome.
