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
module rec Dat | |
open Browser.Types | |
open Fable.Core | |
open System | |
[<ImportAll("dat.gui")>] | |
let exports: IExports = jsNative | |
[<AllowNullLiteral>] |
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
let rec cross (left,right) = | |
match left with | |
| [] -> 0 | |
| _ -> seq { | |
for x in right do | |
let newRight = right |> List.filter(fun a -> a <> x) | |
yield x + go(x::left, newRight) }|> Seq.min | |
and go (left,right) = | |
match left with | |
| [x] -> x |
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
let y f = | |
let f' (x:obj -> _) = f (fun y -> x x y) | |
f' (fun x -> f' (x :?> _)) | |
module AsyncResult = | |
open System.Threading.Tasks | |
open System |
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
let y f = | |
let f' (x:obj -> _) = f (fun y -> x x y) | |
f' (fun x -> f' (x :?> _)) | |
module AsyncResult = | |
open System.Threading.Tasks | |
open System |
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
let y f = | |
let f' (x:obj -> _) = f (fun y -> x x y) | |
f' (fun x -> f' (x :?> _)) | |
module AsyncResult = | |
open System.Threading.Tasks | |
open System |
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
module BDD | |
open Akkling | |
open Akkling.Streams | |
open Akkling.TestKit | |
open Akka.Actor | |
open System | |
open Xunit | |
open Akkling.Streams.Operators | |
open Akka.Streams.Dsl |
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
module Server.App | |
open System | |
open Akka.Streams | |
open Akka.Streams.Dsl | |
open Akkling | |
open Akkling.Streams | |
open Akkling.Streams.Operators | |
open Akka |
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 Part< | |
P extends number, | |
A extends number[], | |
Left extends number[] = [], | |
Right extends number[] = [], | |
> = A extends [] | |
? [P, Left, Right] | |
: A extends [infer F extends number, ...infer Rest extends number[]] |
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 level bubble sort algorithm | |
// https://twitter.com/anuraghazra | |
type BubbleSort< | |
A extends any[], | |
Curr extends number = A["length"] | |
> = Curr extends 1 | |
? A | |
: A extends [infer F, infer S, ...infer Rest] | |
? BubbleSort< |
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
module FSharpX = | |
module Operators = | |
/// Inject a value into the monadic type | |
let inline returnM builder x = (^M: (member Return: 'b -> 'c) (builder, x)) | |
let inline bindM builder m f = (^M: (member Bind: 'd * ('e -> 'c) -> 'c) (builder, m, f)) | |
let inline liftM builder f m = | |
let inline ret x = returnM builder (f x) | |
bindM builder m ret |