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
exception StringMsgs of string list | |
exception IntMsgs of int list | |
try | |
raise <| StringMsgs [""] | |
with | |
| StringMsgs strList -> "strList" | |
| IntMsgs intList -> "intList" | |
| e -> "Everything else" |
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
#I @"C:\Repos\Hopac.IO\packages\Hopac\lib\net45" | |
#r "Hopac.dll" | |
#r "Hopac.Core.dll" | |
open System | |
open Hopac | |
open Hopac.Infixes | |
open Hopac.Stream | |
let rnd = Random() |
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
framework: netstandard2.0 | |
source https://www.nuget.org/api/v2 | |
source https://www.myget.org/F/azure-appservice/api/v2 | |
source https://www.myget.org/F/30de4ee06dd54956a82013fa17a3accb/ | |
source https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json | |
storage: none | |
nuget FSharp.Compiler.Service 13.0.0 | |
nuget FSharp.Core 4.2.2 |
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
"debug.allowBreakpointsEverywhere": true, | |
"editor.tokenColorCustomizations": { | |
"textMateRules": [ | |
{ | |
"scope": "variable.other.binding.fsharp", | |
"name": "binding names", | |
"settings": { | |
"fontStyle": "bold", | |
"foreground": "#DCDCAA" | |
} |
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 FSharpx.Option | |
module String20 = | |
open System.Text.RegularExpressions | |
type T = String20 of string | |
let createWithCont success failure (s: string) = | |
if Regex.IsMatch(s,@"^\w{1,20}$") | |
then success (String20 s) | |
else failure "string length is more than 20" |
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
using System; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace ConsoleApp1 | |
{ | |
class Program | |
{ | |
static void Print() | |
{ |
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
private static async Task<T> Reduce<T>(Func<T, T, T> f, T[] ie, int start, int finish) | |
{ | |
var len = finish - start + 1; | |
if (len == 0) | |
{ | |
throw new Exception("Sequence contains no elements"); | |
} | |
else if (len == 1) | |
{ | |
return ie[start]; |
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 reduceParallelAsync<'a> f (ie: 'a array) = | |
let rec reduceRec f (start, finish) = | |
let reduce = reduceRec f | |
async { | |
match (finish - start + 1) with | |
| 1 -> return ie.[start] | |
| 2 -> return f ie.[start] ie.[start+1] | |
| len -> | |
let h = len / 2 + start | |
let! o1a = reduce(start, h-1) |> Async.StartChild |
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 Result = | |
let foldish xs = | |
let resFolder state curResult = | |
match state, curResult with | |
| Error err, _ | |
| _ , Error err -> Error err | |
| Ok rs , Ok r -> Ok (r::rs) | |
Seq.fold resFolder (Result.Ok []) xs | |
|> Result.map List.rev |
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 SingleDuConverter | |
open Newtonsoft.Json | |
open Microsoft.FSharp.Reflection | |
open System | |
open System.Collections.Generic | |
open Newtonsoft.Json.Linq | |
type SingleDuConverter() = |