Skip to content

Commit

Permalink
Bit of code clean-up.
Browse files Browse the repository at this point in the history
Former-commit-id: 73ad03a
  • Loading branch information
bryanedds committed Jan 4, 2015
1 parent c4e701f commit b2b25c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Nu/Nu/Nu/Desync.fs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module Desync =
World.unsubscribe subscriptionKey world
let advance = fun event world ->
let desync = World.getCallbackState callbackKey world : Event<'a, 'o> -> Desync<Event<'a, 'o>, World, unit>
let (world, advanceResult) = advance desync event world
let (world, advanceResult) = advanceDesync desync event world
match advanceResult with
| Right () -> unsubscribe world
| Left desyncNext -> World.addCallbackState callbackKey desyncNext world
Expand Down
14 changes: 7 additions & 7 deletions Prime/Prime/Prime/Desync.fs
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,16 @@ module Desync =
let during (pred : 's -> bool) (m : Desync<'e, 's, unit>) =
loop () id (fun _ -> pred) (fun _ -> m)

/// TODO: document.
/// Step once into a desync.
let step (m : Desync<'e, 's, 'a>) (s : 's) : 's * Either<'e -> Desync<'e, 's, 'a>, 'a> =
match m with Desync f -> f s

/// Advance a desync value by one step.
let advance (m : 'e -> Desync<'e, 's, 'a>) (e : 'e) (s : 's) : 's * Either<'e -> Desync<'e, 's, 'a>, 'a> =
/// Advance a desync value by one step with the given event 'e'.
let advanceDesync (m : 'e -> Desync<'e, 's, 'a>) (e : 'e) (s : 's) : 's * Either<'e -> Desync<'e, 's, 'a>, 'a> =
step (m e) s

/// TODO: document.
let rec run (m : Desync<'e, 's, 'a>) (e : 'e) (s : 's) : ('s * 'a) =
/// Run a desync to its end, providing the event 'e' for all its steps.
let rec runDesync (m : Desync<'e, 's, 'a>) (e : 'e) (s : 's) : ('s * 'a) =
match step m s with
| (s', Left m') -> run (m' e) e s'
| (s', Left m') -> runDesync (m' e) e s'
| (s', Right v) -> (s', v)

0 comments on commit b2b25c6

Please sign in to comment.