BenchmarkDotNet=v0.12.0, OS=Windows 10.0.18363
Intel Core i5-4430 CPU 3.00GHz (Haswell), 1 CPU, 4 logical and 4 physical cores
.NET Core SDK=3.1.200
[Host] : .NET Core 3.1.2 (CoreCLR 4.700.20.6602, CoreFX 4.700.20.6702), X64 RyuJIT DEBUG
DefaultJob : .NET Core 3.1.2 (CoreCLR 4.700.20.6602, CoreFX 4.700.20.6702), X64 RyuJIT
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
// Reference: https://asc.di.fct.unl.pt/~jleitao/pdf/dsn07-leitao.pdf | |
module Protocols.Hyparview | |
open System | |
open System.Runtime.ExceptionServices | |
open System.Threading | |
type Endpoint = string | |
type TTL = int |
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 | |
[<Struct>] type Effect<'env, 'out> = Effect of ('env -> Async<'out>) | |
[<RequireQualifiedAccess>] | |
module Effect = | |
/// Create value with no dependency requirements. | |
let inline value (x: 'out): Effect<'env,'out> = Effect (fun _ -> async.Return x) | |
/// Create value which uses depenendency. |
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
using System; | |
using System.Collections.Concurrent; | |
using System.Threading; | |
namespace CsDemo | |
{ | |
public static class ObservableExtensions | |
{ | |
/// <summary> | |
/// Pass through up to <paramref name="count"/> items downstream within given <paramref name="interval"/>. |
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 System.IO | |
open System.Threading.Tasks | |
(* | |
Some notes: | |
1. TextWriter is overbloated. Ideally this should be something like Go's io.Writer interface. Notice that Go doesn't | |
differentiate between async/non-async functions (it doesn't have to), which makes API even simpler. | |
2. While very rough, this snippet already provides a lot of what mature logging frameworks (like Serilog) can do: |
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
/// Toy implementation of CAS Paxos (see: https://github.com/rystsov/caspaxos/blob/master/latex/caspaxos.pdf). | |
module DemoFs.CASPaxos | |
open Akka.Actor | |
open Akkling | |
open System | |
type NodeId = string | |
[<Struct>] |
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
module Program = | |
type InMemoryDb(replica: ReplicaId) = | |
let snapshot = ref null | |
let mutable events : Map<uint64,obj> = Map.empty | |
interface Db with | |
member _.SaveSnapshot state = async { snapshot := (box state) } | |
member _.LoadSnapshot<'s>() = async { | |
match !snapshot with |
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
// #r "nuget: Ply" | |
// #r "nuget: BCrypt.Net-Next" | |
module FsDemo.Demo1 | |
open System | |
open System.Text | |
open System.Threading.Tasks | |
open FSharp.Control.Tasks.Builders |
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 System.Threading | |
open Akkling | |
open DemoFs | |
[<EntryPoint>] | |
let main argv = | |
let config = """ | |
akka.loglevel = DEBUG |
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
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Runtime.InteropServices; | |
using System.Threading.Tasks; | |
namespace Demo | |
{ | |
public readonly struct Void |