Sample code for blog post Null-checking considerations in F# - it's harder than you think
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
(* | |
* all of ProvidedTypes.fs | |
* as of https://github.com/fsprojects/FSharp.TypeProviders.StarterPack/blob/245fe3b0126ac6a326a14a0f6b1ef569680b08b3/src/ProvidedTypes.fs | |
*) | |
// then add to the bottom | |
interface ITypeProvider2 with | |
member __.GetStaticParametersForMethod(methodWithoutArguments:MethodBase) = | |
match methodWithoutArguments.Name with |

Sample code for blog post A handy Powershell filter for converting plain text to objects
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 | |
open System.Collections | |
open System.Collections.Generic | |
open System.Diagnostics | |
open System.Linq | |
module Algos = | |
// | |
// non-lazy solutions | |
// |
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.Collections.Generic | |
let someDataSource = seq{ 1 .. 100 } | |
let ordersForTask = Dictionary<int, seq<int>>() | |
let getOrdersForTask task = | |
match ordersForTask.TryGetValue task with | |
| true, orders -> orders | |
| false, _ -> | |
let orders = |
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
[<AutoOpen>] | |
module Ops = | |
open NonStructuralComparison | |
let inline nsHash x = hash x | |
let inline nsCompare x = compare x | |
let inline (=&) a b = a = b | |
let inline (<>&) a b = a <> b | |
let inline (<&) a b = a < b | |
let inline (>&) a b = a > b | |
let inline (<=&) a b = a <= b |
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.Collections.Generic | |
open System.Diagnostics | |
let groupBy keyMaker elements = | |
elements |> Seq.groupBy keyMaker |> Seq.length | |
let loopGroup keyMaker elements = | |
let d = Dictionary<string, seq<'a>>() | |
for p in elements do | |
let key = keyMaker p |
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
#time ;; | |
let testNoTry () = | |
let mutable x = 0 | |
for i in 1 .. 1000000000 do | |
x <- x + 1 | |
x | |
let testTry () = | |
let mutable x = 0 |
#F# Script Debugging
Adds supprt the to Visual F# tooling for rich debugging of F# scripts.
##Motivation F# developers love the low-overhead, iterative REPL experience they have today, but when scripts become larger and more complex, they become difficult to debug. There is no interaction whatsoever today between Editor + F# Interactive and the VS Ddbugger. Thus to debug complex scripts, devs must resort to one of:
printf
debugging- Create a console app, paste in script code, F5-debug the console app