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 traverse and sequence #8

Open
mlms13 opened this issue Jan 8, 2020 · 2 comments
Open

Add traverse and sequence #8

mlms13 opened this issue Jan 8, 2020 · 2 comments

Comments

@mlms13
Copy link
Member

mlms13 commented Jan 8, 2020

Just want to make a note so I don't forget...

let traverse: ('a => Generator.t('b), list('a)) => Generator.t(list('b));
let sequence: list(Generator.t('a)) => Generator.t(list('a));

Naming is a bit of an issue, since this is primarily a list traversal, so Generator.traverse is pretty misleading. Generator.List.traverse feels backward for the same reason (especially when you consider the existence of List.Option.traverse in the ecosystem). Generator.ListOf makes the backward-ness more clear, but seems cumbersome. Maybe just Generator.listTraverse?

@andywhite37
Copy link
Member

Just to add a data point, for things that are specialized to list/etc., I've been naming things with whateverAsList and whateverAsArray, so these could be traverseAsList and sequenceAsList - that way, you can find them via auto-suggest, but it's clear they are specialized.

@mlms13
Copy link
Member Author

mlms13 commented Jan 9, 2020

Good call on the auto-suggest. I'll follow the same pattern.

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

No branches or pull requests

2 participants