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.Text.Json | |
open System.Text.Json.Serialization | |
open BenchmarkDotNet.Attributes | |
open BenchmarkDotNet.Running | |
type MyUnion = | |
| Foo | |
| Bar of int * string | |
type Unions() = |
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.IO | |
open System.Threading.Tasks | |
open FSharp.Control.Tasks.TaskBuilder | |
open FSharp.Control.Tasks.V2 | |
type UnitTaskBuilder() = | |
inherit TaskBuilderV2() | |
member _.Run(x) = base.Run(x) :> Task | |
let utask = UnitTaskBuilder() |
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 reply to: https://twitter.com/davidfowl/status/1282445306261471232 | |
// This implements a connection of some kind that can be started and stopped asynchronously. | |
// We must ensure that we don't try to start it while it is stopping or vice-versa. | |
// A few internal types first... | |
/// Contains whatever state needs to be held on to while connected. | |
type private ConnectedState = { Id: int } | |
/// The state of the internal agent. Describes the current status of the connection, |
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.Linq; | |
var coll = Enumerable.Range(1, 10); | |
// We need to repeat "int" here, it can't be implied by IntAdd or IntMul :( | |
Console.WriteLine($"The sum is {AppendMany<IntAdd, int>(coll)}"); | |
Console.WriteLine($"The product is {AppendMany<IntMul, int>(coll)}"); |
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
type Attr = delegate of RenderTreeBuilder * int -> int | |
type Node = delegate of RenderTreeBuilder * int -> int | |
type NodeBuilder(name: string) = | |
static member Empty = Node(fun _sb x -> x) | |
member _.Name = name |
OlderNewer