Discussion: API Changes for Hopac 1.0
See original GitHub issueI’d like to push toward a stable 1.0 API for Hopac. Much of the API looks good and is relatively stable, but there may be some changes that we can make before a 1.0 release that can improve the usability of the API. Below are a couple of my ideas.
-
Rollback use of constructors for
PromisesandIVarand some others, preferringcreate/createFull/createFailedfunctions. -
The idea of removing
Schedulerfrom the design has been previously discussed. I am not sure quite where to start to do this, but it may be better to reserve for a possible 2.0. -
Move away from functional jargon names or add functions that have more names that are more “friendly” to new users. Taking a page from Elm, possibly introduce
andThenas a synonym forbind. -
It is too easy to use
Alt.prepareincorrectly, often doing synchronous work (or worse, waiting on jobs synchronously) before returning theAlt. Instead users that need to do asynchronouse work before anAltis ready should be creating aPromise(throughmemo, for example) so that theAltcan finish instantiation and then continue to instantiate otherAlts in achooseblock. Possibly add documentation to the variousAltfunctions and/or add other functions intoAltthat provide the intended functionality (even if simple synonyms to existing functions). -
Harmonize the names of
Job/Alt/Promisefunctions that returnunit, a constant, an exception, and that never return.
Each of these and more may spawn additional tickets, but I wanted to get some feedback before I go running off with this.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)

Top Related StackOverflow Question
-1 for the renames @21c-HK suggests. I also disagree with the justification; there’s no good auto-complete for huge F# projects in Ionide, so I type the Hopac functions and types all the time.
I think this project shouldn’t focus on making it easier to understand, but making it easier to get started and find documentation and experimenting. Perhaps we can compile to wasm?
I think bind is fine. If you want to improve ease of use focus on exposing computation expressions in documentation. Most F# programmers are at least experienced in consuming CE’s.