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 UoM = | |
// Units of measure for other than integral types | |
let inline (++) (w: ^W when ^W: (static member IsMeasureAbbrev: ^tm * ^t -> unit)) (t: ^t) = (# "" t: ^tm #) | |
let inline (--) (w: ^W when ^W: (static member IsMeasureAbbrev: ^tm * ^t -> unit)) (tm: ^tm) = (# "" tm: ^t #) | |
[<MeasureAnnotatedAbbreviation>] | |
type Guid<[<Measure>] 'm> = Guid |
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 Microsoft.FSharp.Collections | |
[<RequireQualifiedAccess>] | |
module Folds = | |
// These are the fast implementations we actually want to use |
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
# If this script is throwing an error near a Unicode symbol try resaving the file as UTF-8 with BOM | |
$psmodules = ";~\Documents\WindowsPowerShell\Modules" | |
# sometimes the module paths has been fucked before posh loads, but that won't stop us | |
$env:PSModulePath = $env:PSModulePath + $psmodules | |
# Set the OutputEncoding to Unicode so that the λ renders properly | |
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 | |
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
[<System.Runtime.CompilerServices.Extension>] | |
type ExtensionMethods() = | |
[<System.Runtime.CompilerServices.Extension>] | |
static member inline GetOption< ^a,'k,'v when 'a : (member TryGetValue : 'k * ('v byref) -> bool)>(this : ^a, key : 'k) = | |
let mutable v = Unchecked.defaultof<'v> | |
let scc = ( ^a : (member TryGetValue : 'k * ('v byref) -> bool) this, key, &v) | |
if scc then | |
Some v | |
else | |
None |
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
// General hints on defining types with constraints or invariants | |
// | |
// Just as in C#, use a private constructor | |
// and expose "factory" methods that enforce the constraints | |
// | |
// In F#, only classes can have private constructors with public members. | |
// | |
// If you want to use the record and DU types, the whole type becomes | |
// private, which means that you also need to provide: | |
// * a constructor function ("create"). |
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 FatalError(message: string) = | |
inherit System.Attribute() | |
member __.Message = message | |
type Errors = | |
| [<FatalError("The value specified is currently not available")>] UnknownValue | |
| NotAnError | |
let PrintErrorMessage : Errors -> string = | |
fun err -> |
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
(*=============================== | |
|| || | |
|| QuickStart || | |
|| || | |
===============================*) | |
// A simple example of a property definition is | |
let prop_RevRev xs = List.rev(List.rev xs) = xs |
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
Capability Red - Requirements at Scale by Liz Keogh | |
http://www.ndcvideos.com/#/app/video/2111 | |
---- | |
Beyond Rectangles in Web Design - CSS Shapes and CSS Masking by Razvan Caliman | |
http://www.ndcvideos.com/#/app/video/2121 | |
---- | |
Coding Culture by Sven Peters | |
http://www.ndcvideos.com/#/app/video/2131 | |
---- | |
The Ultimate Logging Architecture - You KNOW You Want It by Michele Leroux Bustamante |
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
#r "PresentationCore" | |
#r "PresentationFramework" | |
#r "WindowsBase" | |
#r "System.Xaml" | |
#I "../../packages/FSharp.Control.Reactive.2.3.1/lib/net40/" | |
#I "../../packages/Rx-Linq.2.2.5/lib/net45" | |
#I "../../packages/Rx-Core.2.2.5/lib/net45" | |
#I "../../packages/Rx-Interfaces.2.2.5/lib/net45" | |
#I "../../packages/Rx-PlatformServices.2.2.5/lib/net45" | |
#I "../../packages/Rx-Providers.2.2.5/lib/net45" |
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.IO | |
let find_files dir = Directory.GetFiles( dir, "*.fs?", SearchOption.AllDirectories ) | |
let not_start (s:string) p = not <| s.StartsWith p | |
let has_type (s:string) = if s.Contains @"type" then 1 else 0 | |
let has_module (s:string) = if s.Contains @"module" then 1 else 0 | |
let has_binding (s:string) = if s.Contains @"let" || | |
s.Contains @"member" then 1 else 0 |