brew install node
This file contains hidden or 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
(* | |
An incomplete implementation of a type-safe SQL query in F#. | |
The idea is that a query is built up clause by clause, by representing | |
each additional clause being added on to the query as a state transition | |
between different types of queries. We capture these different types as | |
phantom types to make sure that only valid transitions (query clause | |
additions) as defined by us can be carried out. | |
The final result is a 'total query' that can be converted to a string, |
Last week I spent a lot of time trying to deploy an F# ASP.NET Core app (a Giraffe app, specifically) to Azure because the information to complete all the steps was scattered in several places. So I'm writing this hopefully it will save the pain to others :)
The following steps are mostly taken from this guide and it's only necessary to do them once:
- Create an account in Azure (or use an existing one)
- Create a resource group (or use an existing one)
Following instructions from the excellent https://www.rinkeby.io/
A full node lets you access all state. There is a light node (state-on-demand) and wallet-only (no state) instructions as well,
This file contains hidden or 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 |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
This file contains hidden or 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 "../packages/FSharp.Data.2.2.5/lib/net40/FSharp.Data.dll" | |
open System | |
open System.IO | |
open FSharp.Data | |
[<Literal>] | |
let lineBreak = "\r\n" | |
type CommitInfo = {Hash : string; Author : string; TimeStamp : DateTime; Message : string} | |
type CommittedFile = {LinesAdded: int option; LinesDeleted: int option; FileName: string} |
This file contains hidden or 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 BusyBuilder(blockUi, unblockUi) = | |
member this.Bind(x, f) = async.Bind(x, f) | |
member this.Combine(e1, e2) = async.Combine(e1, e2) | |
member this.Delay(f) = | |
async { | |
blockUi () | |
let! result = async.Delay f | |
unblockUi () | |
return result | |
} |
This file contains hidden or 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 Topshelf | |
[<AutoOpen>] | |
module Topshelf = | |
open System | |
open Topshelf.HostConfigurators | |
open Topshelf.Runtime | |
let configureTopShelf f = |