You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here I'm making a short list of key things to improve in consul-haskell.
Document all functions.
Provide some examples for common distributed-systems tasks, such as running a service with a health check from Haskell, or running a master-elected task across multiple Haskell servers.
Sensibly group funciton docs into sections of tasks that you usually want to accomplish with consul.
Use of Bool on errors.
For example registerService :: ... -> m Bool returns False on any non-HTTP-200 response, discarding any useful error message, thus making it unclear how the caller should handle that case. Invalid request, or temporary loss of cluster leadership? The caller cannot tell.
Some functions don't seem to check the status code at all; we need to fix that.
Clean up comment this is here instead of the where to prevent typechecking nastiness
Move the datacenter into ConsulClient (like the Python bindings do).
Currently most functions take Maybe Datacenter as an argument, but it is usually not used, and if used, usually the same.
Fix usage of plain async.
That function isn't exception-safe (see first section of the main docs of the async package); use withAsync or other safe helper utilities that the docs instruct to use instead.
Extract common code for functions that make requests.
Most functions have very similar implementation:
Here I'm making a short list of key things to improve in
consul-haskell.Boolon errors.For example
registerService :: ... -> m BoolreturnsFalseon any non-HTTP-200 response, discarding any useful error message, thus making it unclear how the caller should handle that case. Invalid request, or temporary loss of cluster leadership? The caller cannot tell.Some functions don't seem to check the status code at all; we need to fix that.
this is here instead of the where to prevent typechecking nastinessConsulClient(like the Python bindings do).Currently most functions take
Maybe Datacenteras an argument, but it is usually not used, and if used, usually the same.async.That function isn't exception-safe (see first section of the main docs of the
asyncpackage); usewithAsyncor other safe helper utilities that the docs instruct to use instead.Most functions have very similar implementation: