io icon indicating copy to clipboard operation
io copied to clipboard

loop + iterate examples to reflect new api

Open ethanniser opened this issue 2 years ago • 0 comments

  • iterate and loop have 'moral equivalent' examples that use the names of the old function arguments
  • the loop example should have a return statement at the end similar to iterate
  • they also use one letter variable names. full variable names provide additional clarity (example from docs recently)
  • finally thoughts on renaming the while option to condition or something similar? while being a language keyword breaks syntax highlighting (you can see this in the api page) and prevents this kind of functionality:
const while = (x: number) => x > 5;
// ^ ERROR "'while' is not allowed as a variable declaration name."
Effect.loop(1, { while, ...otherOptions });

ethanniser avatar Jul 07 '23 05:07 ethanniser