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

Generalized API changes #152

Open
neoeinstein opened this issue Feb 16, 2017 · 3 comments
Open

Generalized API changes #152

neoeinstein opened this issue Feb 16, 2017 · 3 comments
Assignees
Milestone

Comments

@neoeinstein
Copy link
Member

neoeinstein commented Feb 16, 2017

This issue is a work in progress, but below you will find a diff with general changes to the API to tidy up some things and make naming consistent.

Signature Changes

Presume that any obsolete API not mentioned below will be removed.

 module Job =
-  val result: 'x -> Job<'x>
-  val unit: unit -> Job<unit>
-  val abort: unit -> Job<'x>
-  val raises: exn -> Job<'x>
+  val always: 'x -> Job<'x>
+  val unit: Job<unit>
+  val never: Job<'x>
+  val fail: exn -> Job<'x>

-  val Ignore: Job<_> -> Job<unit>
+  val ignore: Job<_> -> Job<unit>

-  val catch: Job<'x> -> Job<Choice<'x, exn>>
+  val catch: Job<'x> -> Job<Result<'x, exn>>

+  val andThen: ('x   -> #Job<'y>) -> Job<'x> -> Job<'y>
+  val andMap: Job<'x> -> Job<'x -> 'y> -> Job<'y>

 module Alt =
   val always: 'x -> Alt<'x>
-  val unit: unit -> Alt<unit>
-  val never: unit -> Alt<'x>
-  val zero: unit -> Alt<unit>
-  val raises: exn -> Alt<'x>
+  val unit: Alt<unit>
+  val never: Alt<'x>
+  val fail: exn -> Alt<'x>

-  val Ignore: Alt<_> -> Alt<unit>
+  val ignore: Alt<_> -> Alt<unit>

 type Promise<'x> =
   inherit Alt<'x>
-  new: unit -> Promise<'x>
-  new: Job<'x> -> Promise<'x>
-  new: 'x -> Promise<'x>
-  new: exn -> Promise<'x>

 module Promise =
   module Now =
-    val inline delay: Job<'x> -> Promise<'x>
-    val inline withValue: 'x -> Promise<'x>
-    val inline withFailure: exn -> Promise<'x>
-    val never: unit -> Promise<'x>
+  val always: 'x -> Promise<'x>
+  val unit: Promise<unit>
+  val never: Promise<'x>
+  val fail: exn -> Promise<'x>

+  val memo: Job<'x> -> Promise<'x>
+  val memoFun: (unit -> 'x) -> Promise<'x>
+  val memoJob: (unit -> #Job<'x>) -> Promise<'x>

   val queue: Job<'x> -> Job<Promise<'x>>
+  val queueFun: (unit -> 'x) -> Job<Promise<'x>>
+  val queueJob: (unit -> #Job<'x>) -> Job<Promise<'x>>

   val start: Job<'x> -> Job<Promise<'x>>
+  val startFun: (unit -> 'x) -> Job<Promise<'x>>
+  val startJob: (unit -> #Job<'x>) -> Job<Promise<'x>>

   val read: Promise<'x> -> Alt<'x>

 type IVar<'x> =
   inherit Promise<'x>
   new: unit -> IVar<'x>
-  new: 'x -> IVar<'x>
-  new: exn -> IVar<'x>

 module IVar =
+  val unit: IVar<unit>
+  val createFull: 'x -> IVar<'x>
+  val createFail: exn -> IVar<'x>

 type MVar<'x> =
   inherit Alt<'x>
   new: unit -> MVar<'x>
-  new: 'x -> MVar<'x>

 module MVar =
+  val createFull: 'x -> MVar<'x>
@neoeinstein neoeinstein added this to the Hopac 1.0 milestone Feb 16, 2017
@neoeinstein neoeinstein self-assigned this Feb 16, 2017
@haf
Copy link
Member

haf commented Mar 9, 2017

Also, please

module Hopac =
- val timeOut: TimeSpan -> Alt<unit>
+ val timeout: TimeSpan -> Alt<unit>
- val timeOutMillis: int -> Alt<unit>
+ val timeoutMillis: int -> Alt<unit>

To make the API use the compsci word

@haf
Copy link
Member

haf commented Mar 11, 2017

Another wish: could we rename Hopac.Infixes to Hopac.Operators to match Chiron, Aether, Suave etc...?

@polytypic
Copy link
Member

As much as possible it would of course be nice to follow any de facto standard naming/structuring conventions. But such changes also cause a lot of migration pain, which is why I never fixed the timeOut mistake, BTW. The name change from timeOut to timeout would only be cosmetic as the name timeOut is unlikely to confuse anyone on a semantic level. Still, if a lot of renamings are going to be done, then why not fix such mistakes as well.

haf added a commit that referenced this issue Aug 4, 2018
Removing obsolete API methods to progress on #152 Generalized api changes
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

3 participants