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 |
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 Spell = | |
{ Name : string | |
Cost : int | |
Damage : int | |
Heal : int | |
Armor : int | |
Mana : int | |
Duration : int } | |
let allSpells = |
JNI Object | Use across JNI calls? | Use on different thread? | Notes |
---|---|---|---|
JavaVM |
Sample code for blog post Benchmarking IEnumerables in F# - Seq.timed
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" standalone="no"?> | |
<!--This file represents the results of running a test suite--> | |
<test-results name="C:\src\FSharp.Compiler.Service\bin\v4.0\FSharp.Compiler.Service.Tests.dll" total="373" errors="2" failures="14" not-run="8" inconclusive="0" ignored="8" skipped="0" invalid="0" date="2016-02-15" time="21:36:11"> | |
<environment nunit-version="2.6.3.13283" clr-version="2.0.50727.8670" os-version="Microsoft Windows NT 6.2.9200.0" platform="Win32NT" cwd="C:\src\FSharp.Compiler.Service" machine-name="LINCOLN-PC" user="lincoln" user-domain="LINCOLN-PC" /> | |
<culture-info current-culture="en-US" current-uiculture="en-US" /> | |
<test-suite type="Test Project" name="" executed="True" result="Failure" success="False" time="112.439" asserts="0"> | |
<results> | |
<test-suite type="Assembly" name="C:\src\FSharp.Compiler.Service\bin\v4.0\FSharp.Compiler.Service.Tests.dll" executed="True" result="Success" success="True" time="52.240" asserts="0"> | |
<results> | |
<test-suite |
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 Test | |
open System.Runtime.InteropServices | |
// F# implementation of http://pinvoke.net/default.aspx/mpr.WNetAddConnection2 | |
module NativeMethods = | |
type ResourceScope = | |
| Connected = 0x1u | |
| GlobalNet = 0x2u |
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
# | |
# Benchmarking code used to produce results from blog post | |
# http://latkin.org/blog/2016/08/02/curious-behavior-when-de-duplicating-a-collection-in-powershell/ | |
# | |
# home-grown HashSet-based approach | |
function hashunique { | |
param( | |
[Parameter(Mandatory=$true, ValueFromPipeline = $true)] | |
[Object[]] $InputObject |