Created
November 6, 2014 16:05
-
-
Save bryanedds/3f7d60169a8316835bfa to your computer and use it in GitHub Desktop.
And yet somehow I'm confident that this will actually run properly the first time...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let product address (observable : 'a Observable) : ('a * 'b) Observable = | |
let subscribe = fun world -> | |
let subscriptionKey = World.makeSubscriptionKey () | |
let subscriptionKey' = World.makeSubscriptionKey () | |
let subscriptionAddress = !+ [acstring subscriptionKey] | |
let subscriptionAddress' = !+ [acstring subscriptionKey'] | |
let (address', unsubscribe, world) = observable.Subscribe world | |
let unsubscribe = fun world -> | |
let world = unsubscribe world | |
let world = World.unsubscribe subscriptionKey world | |
World.unsubscribe subscriptionKey' world | |
let subscription = fun event world -> | |
let subscription' = fun event' world -> | |
let eventData = (event.Data, event'.Data) | |
let world = World.publish<'a * 'b> World.sortSubscriptionsNone subscriptionAddress subscriptionAddress eventData world | |
(Cascade, world) | |
let world = World.subscribe<'b> subscriptionKey' address' subscriptionAddress' subscription' world | |
(Cascade, world) | |
let world = World.subscribe<'a> subscriptionKey address subscriptionAddress subscription world | |
(subscriptionAddress, unsubscribe, world) | |
{ Subscribe = subscribe; TypeCarrier = fun (_ : 'a * 'b) -> () } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment