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
<Query Kind="FSharpProgram"> | |
<NuGetReference>Avalonia</NuGetReference> | |
<NuGetReference>Avalonia.Desktop</NuGetReference> | |
<NuGetReference>Avalonia.Themes.Fluent</NuGetReference> | |
<NuGetReference>Vide.UI.Avalonia</NuGetReference> | |
<Namespace>Avalonia</Namespace> | |
<Namespace>Vide</Namespace> | |
<Namespace>Vide.UI.Avalonia</Namespace> | |
</Query> |
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
// Experiment | |
open System | |
open System.Collections.Generic | |
open System.Runtime.CompilerServices | |
// Case-insensitive strings for ValueTuple embedding. | |
[<IsReadOnly; Struct; CustomEquality; CustomComparison>] | |
type OrdinalIgnoreCaseString = | |
{ Value: 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
// No early return | |
// Prints "gotcha" | |
async { | |
return () | |
printfn "gotcha" | |
} | |
|> Async.RunSynchronously | |
// Early return | |
// Does not print anything |
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
// Use the Test solution configuration and now test cases will fail if they are using '=' on structs. | |
#if STRUCT_EQ_CHECK | |
[<AutoOpen>] | |
#endif | |
module StructEqCheck = | |
type StructEqualityException() = | |
inherit exn() | |
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
/// Equatable operators - avoid boxing operands when comparing structs. | |
/// Source: https://github.com/dotnet/fsharp/issues/526#issuecomment-119755563 | |
module EquatableOperators = | |
let inline eq<'a when 'a :> System.IEquatable<'a>> (x:'a) (y:'a) = x.Equals y | |
let inline (==) x y = eq x y | |
let inline (!=) x y = not (eq x y) | |
/// We get a fair warning that it's odd that we impl. custom equality | |
/// when we deny the equality operator. | |
[<Struct; NoEquality; NoComparison>] |
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
// Compile-time error on contradictive conditional compilation symbols. | |
// Make conditional compilation symbols form a discriminated union. | |
#if (SITE_DEV && SITE_TEST) | |
§"Contradictive conditional compilation symbols" | |
#endif |
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
<Query Kind="Statements"> | |
<Namespace>System.Net.Http</Namespace> | |
<Namespace>System.Threading.Tasks</Namespace> | |
<Namespace>System.Dynamic</Namespace> | |
</Query> | |
await TestAsync("Foo", http => http.GetStringAsync("http://www.google.com/"), HttpFormatOptions.Verbose); | |
static object Title(string message, bool isError = false) |
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
<Query Kind="Program"> | |
<NuGetReference>Observito.Trace.EventSourceFormatter</NuGetReference> | |
<Namespace>Observito.Trace.EventSourceFormatter</Namespace> | |
<Namespace>System.Collections.Immutable</Namespace> | |
<Namespace>System.Diagnostics.Tracing</Namespace> | |
</Query> | |
#nullable enable | |
void Main() |
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
<Query Kind="FSharpProgram"> | |
<NuGetReference>FSharp.Data.Adaptive</NuGetReference> | |
<Namespace>FSharp.Data.Adaptive</Namespace> | |
<Namespace>FSharp.Data.Traceable</Namespace> | |
</Query> | |
// F# - what the F* is this sorcery?! :-) | |
// create a temporary directory |
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
<Query Kind="Program"> | |
<NuGetReference>Serilog</NuGetReference> | |
<NuGetReference>Serilog.Sinks.LINQPad</NuGetReference> | |
<Namespace>System.Dynamic</Namespace> | |
<Namespace>Serilog</Namespace> | |
</Query> | |
// Just an experiment; you should probably never use this. :-) | |
// Would be nicer with compile-time function creation but not possible atm afaik. |
NewerOlder