Skip to content

Instantly share code, notes, and snippets.

Oskar Gewalli wallymathieu

View GitHub Profile
View Collection.fs
open FSharpPlus
open FSharpPlus.Operators
module Collection=
let inline maximaBy (projection: 'T->'Key) (source: '``Collection<'T>``) : '``Collection<'T>``=
let sorted = sortByDescending projection source
match tryHead sorted with
| None -> sorted
| Some max -> takeWhile ((compare <| projection max) >> (=) 0 << projection) sorted
@wallymathieu
wallymathieu / fsharp_codeformat.txt
Created Jan 29, 2018
V2 vs V3 of FSharp Formatting assemblies
View fsharp_codeformat.txt
* FSharp.CodeFormat.Constants
Added: FSharp.CodeFormat.Constants (.NET type: Module and base: System.Object)
+ (Instance/Inheritance of FSharp.CodeFormat.Constants).Equals :
obj:System.Object
-> System.Boolean
@wallymathieu
wallymathieu / build.log
Created Jan 28, 2018
building a .net core solution / project in Visual Studio for Mac
View build.log
Building Solution: SynVer (Debug)
Build started 1/28/2018 5:03:07 PM.
__________________________________________________
Project "/Users/mathieu/src/SyntacticVersioning/src/SynVer.Lib/SynVer.Lib.fsproj" (Build target(s)):
Target GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
Target CoreCompile:
/usr/local/share/dotnet/sdk/2.1.4/FSharp/RunFsc.sh -o:obj/Debug/netstandard2.0/SynVer.Lib.dll
View fsharpplus_haskell_compatibility.md
+--------------------+--------------------+-------------------------+--------------------+
|Operation           | F#+ / F#           |F#+ Haskell Compatibility|Haskell             |
+====================+====================+=========================+====================+
|List.append         | @                  |                         | ++                 |
+--------------------+--------------------+-------------------------+--------------------+
|Function composition| f << g             | f . (g)                 | f . g              |
+--------------------+--------------------+-------------------------+--------------------+
|                    | <|                 | $                       | $                  |
+--------------------+--------------------+-------------------------+--------------------+
View fsharpplus_haskell_compatibility.md
+--------------------+--------------------+-------------------------+--------------------+
|Operation           | F#+ / F#           |F#+ Haskell Compatibility|Haskell             |
+====================+====================+=========================+====================+
|List.append         | @                  |                         | ++                 |
+--------------------+--------------------+-------------------------+--------------------+
|                    | <<                 |                         | .                  |
+--------------------+--------------------+-------------------------+--------------------+
|                    | <|                 | $                       | $                  |
+--------------------+--------------------+-------------------------+--------------------+
@wallymathieu
wallymathieu / Validation.fsx
Last active Jan 6, 2018 — forked from gusty/Validation.fsx
Applicative Validation easy with F#+
View Validation.fsx
#r @"c:/packages/FSharpPlus.1.0.0-CI00099/lib/net45/FSharpPlus.dll"
open System
open FSharpPlus
// Validation definition
type Validation<'a,'e> = Success of 'a | Failure of 'e
with
// Validation is an instance of Applicative
static member inline Return x = Success x
@wallymathieu
wallymathieu / recursive_include.csproj
Last active Jan 2, 2018
Recursive include of c# files in a project
View recursive_include.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\SomeOtherProject\SomeFolder\*.cs">
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
@wallymathieu
wallymathieu / us-states.xml
Created Dec 14, 2017 — forked from bzerangue/us-states.xml
List of States in the United States of America (with dates of when they became as state)
View us-states.xml
<?xml version="1.0" encoding="UTF-8"?>
<states nation="United States of America" nation-abbreviation="USA" nation-capital="Washington, D.C.">
<state name="Alabama" abbreviation="AL" capital="Montgomery" date="1819-12-14" most-populous-city="Birmingham" population="4708708" square-miles="52423" time-zone-1="CST (UTC-06)" time-zone-2="EST (UTC-05)" dst="Yes"/>
<state name="Alaska" abbreviation="AK" capital="Juneau" date="1959-01-03" most-populous-city="Anchorage" population="698473" square-miles="656425" time-zone-1="AKST (UTC-09)" time-zone-2="HST (UTC-10)" dst="Yes"/>
<state name="Arizona" abbreviation="AZ" capital="Phoenix" date="1912-02-14" most-populous-city="Phoenix" population="6595778" square-miles="114006" time-zone-1="MT (UTC-07)" dst="No"/>
<state name="Arkansas" abbreviation="AR" capital="Little Rock" date="1836-06-15" most-populous-city="Little Rock" population="2889450" square-miles="53182" time-zone-1="CST (UTC-06)" dst="Yes"/>
<state name="California" abbreviation="CA" capital="Sacrame
View CpsTests.fs
module Tests
open System
open Xunit
open System
open ExtCore.Control.Cps
open ExtCore.Control.Collections.Cps
//https://github.com/fabriceleal/Continuations/blob/master/Continuations/Program.fs
View AsyncResult.fs
[<AutoOpen>]
module AsyncResult
//from https://github.com/SuaveIO/suave/blob/master/src/Suave/WebPart.fs
type AsyncResult<'a,'e> = Async<Result< 'a,'e>>
let inline succeed x = async.Return (Ok x)
let bind (f: 'a -> AsyncResult<'b,'e>) (a: AsyncResult<'a,'e>) = async {
let! p = a
match p with
You can’t perform that action at this time.