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
namespace Marvel | |
open System | |
open System.Diagnostics | |
open System.Threading | |
open System.Threading.Tasks | |
open Marvel | |
/// The 'Vsync' (AKA, 'Variable Synchrony') monad. | |
/// Runs code synchronously when the 'Venom/System/Sync' Consul variable is 'True', in parallel otherwise. | |
/// NOTE: to reference how all this stuff works in F#, see here - https://msdn.microsoft.com/en-us/library/dd233182.aspx |
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
namespace YourNamespaceHere | |
open System | |
open System.Diagnostics | |
open System.Threading | |
open System.Threading.Tasks | |
/// The 'Sync' builder for evaluating expressions in a synchronous style to aid debugging. | |
type [<Sealed>] Sync () = | |
member inline this.Bind (x, f) = f x | |
member inline this.Return x = x |
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
open System | |
open FSharpx.Reader | |
[<AutoOpen>] | |
module LoggerModule = | |
/// A fake logger type. | |
type Logger = | |
private { __ : unit } |
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
open FSharpx.State | |
/// A tic-tac-toe piece, or the absence thereof. | |
type Piece = U | X | O | |
/// Tic-tac-toe board position. | |
type Position = { X : int; Y : int } | |
[<AutoOpen>] | |
module GameModule = |
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
/// A tic-tac-toe piece, or the absence thereof. | |
type Piece = U | X | O | |
/// Tic-tac-toe board position. | |
type Position = { X : int; Y : int } | |
[<AutoOpen>] | |
module GameModule = | |
/// A tic-tac-toe game implemented as a Pure ADT. |
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
open System | |
[<AutoOpen>] | |
module LoggerModule = | |
/// A fake logger type. | |
type Logger = | |
private { __ : unit } | |
[<RequireQualifiedAccess; CompilationRepresentation (CompilationRepresentationFlags.ModuleSuffix)>] |
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
namespace Prime | |
open System | |
[<AutoOpen>] | |
module RandModule = | |
/// Implements an immutable random number generator using the xorshift* algorithm. | |
/// NOTE: this is POORLY tested - would not recommend using until tested properly! | |
type [<StructuralEquality; NoComparison>] Rand = | |
{ Current : uint64 } |
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 |
NewerOlder