This file contains 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 |
This file contains 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 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 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 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 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 MyRecord = | |
{ | |
x: int | |
y: string | |
} |
This file contains 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 Avalonia.Media.TextFormatting.Unicode | |
open Avalonia.Utility | |
[<Struct; IsByRefLike>] | |
type CodepointEnumerator = | |
val mutable text : ReadOnlySlice<char> | |
val mutable current : Codepoint |
This file contains 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 Avalonia.Media.TextFormatting.Unicode | |
open Avalonia.Utility | |
[<Struct; IsByRefLike>] | |
type CodepointEnumerator(text: ReadOnlySlice<char>) = | |
let mutable text = text | |
let mutable current = Codepoint.ReplacementCodepoint |
This file contains 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
<?xml version="1.0" encoding="utf-8"?> | |
<Project> | |
<!-- | |
Override NuGet (or Paket) references with a set of local projects. | |
Usage: | |
* Add this file at the root above all your projects, so that they all gain the capability to override a package. | |
* In a solution where you want to override a package, add a file Directory.Build.props like the following: | |
<?xml version="1.0" encoding="utf-8"?> | |
<Project> |
This file contains 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 User = { name: string; (* ... *) } | |
type UserId = int | |
type EndPoint<_> = | |
| [<EndPoint "GET /user/{id}">] | |
GetUser : id: UserId -> EndPoint<Json<User>> | |
| [<EndPoint "POST /user"; Json "userData">] | |
CreateUser : userData: User -> EndPoint<Json<UserId>> |
NewerOlder