Conversation
|
cjol
left a comment
There was a problem hiding this comment.
I would personally have been inclined to put the wttr client in a dedicated Requirement (e.g. so it can be mocked in tests etc), but that's very optional!
| // Based on the given options and arguments, you could invoke different (sub)commands here or | ||
| // pass different parameters to your command function. In this example, we only have a single | ||
| // command, so we just invoke it directly. | ||
| Effect.gen(function* ($) { |
There was a problem hiding this comment.
It's possible that the docs are already outdated (I haven't kept up!) but the generator page suggests that _ is more of a convention than $. Worth being consistent?
The _ symbol is just a convention for the argument name and is not a special symbol in Effect. You are free to use any name you prefer (e.g., $, etc...). The current convention is to use _ as the argument name.
https://effect.website/docs/essentials/using-generators#understanding-effectgen
There was a problem hiding this comment.
I don't have a strong preference here. We've been using both $ and _ interchangeably in the other per-repo examples of the core ecosystem.
I think I have a slight preference for $ since I personally already use _ fo both "throw away" and non-name-worthy, short-lived, tightly scoped parameters in lambda functions (e.g. Effect.map(_ => _.foo)) or for pattern matching, etc.
We've had that before but decided that that was out of scope for the example (simplicity over full completess / correctness). We can't show all idiomatic patterns in one go without making it too complicated to parse for a newcomer. |
| @@ -0,0 +1,77 @@ | |||
| import { Effect, Option, Layer } from 'effect' | |||
There was a problem hiding this comment.
looks like the Layer import is not used
No description provided.