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
// 1. pure, don't think about IO at all | |
module Domain = | |
let add x y = x + y | |
// 2. think about IO but not its implementation | |
module App = | |
let add (getX: unit -> Async<int32>) y = | |
async { | |
let! x = getX () | |
return Domain.add x y |
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 FSharpPlus | |
open FSharpPlus.TypeLevel | |
let x = TypeNat<2>.Value | |
// For more information see https://aka.ms/fsharp-console-apps | |
printfn "Hello from F#" |
This file has been truncated, but you can view the full file.
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
<?xml version="1.0" encoding="utf-8"?> | |
<coverage line-rate="0.1306" branch-rate="0.0974" version="1.9" timestamp="1592029460" lines-covered="512" lines-valid="3919" branches-covered="343" branches-valid="3519"> | |
<sources> | |
<source>/Users/mathieu/src/fs/FSharpPlus/src/FSharpPlus/</source> | |
</sources> | |
<packages> | |
<package name="FSharpPlus" line-rate="0.1306" branch-rate="0.0974" complexity="5733"> | |
<classes> | |
<class name="FSharpPlus.Internals.Id`1" filename="Internals.fs" line-rate="0" branch-rate="1" complexity="2"> | |
<methods> |
This file has been truncated, but you can view the full file.
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
<?xml version="1.0" encoding="utf-8"?> | |
<coverage line-rate="0.1306" branch-rate="0.0974" version="1.9" timestamp="1592029460" lines-covered="512" lines-valid="3919" branches-covered="343" branches-valid="3519"> | |
<sources> | |
<source>/Users/mathieu/src/fs/FSharpPlus/src/FSharpPlus/</source> | |
</sources> | |
<packages> | |
<package name="FSharpPlus" line-rate="0.1306" branch-rate="0.0974" complexity="5733"> | |
<classes> | |
<class name="FSharpPlus.Internals.Id`1" filename="Internals.fs" line-rate="0" branch-rate="1" complexity="2"> | |
<methods> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
[AttributeUsage(System.AttributeTargets.All, AllowMultiple = true, Inherited = true)] | |
public class ಠ_ಠAttribute : Attribute | |
{ | |
public ILog Log { get; set; } | |
public ಠ_ಠAttribute() | |
{ | |
Log.Info("This code is bad and you should feel bad"); | |
} | |
} |
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
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<TargetFramework Condition="$(Configuration)=='Test'">netcoreapp3.0</TargetFramework> | |
<TargetFramework Condition="$(Configuration)!='Test'">netstandard2.0</TargetFramework> | |
<IsPackable Condition="$(Configuration)=='Test'">false</IsPackable> | |
<DefineConstants Condition="$(Configuration)=='Test'">TESTS</DefineConstants> | |
</PropertyGroup> |
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
# Generator for valid Swedish personnummer: http://en.wikipedia.org/wiki/Personal_identity_number_(Sweden) | |
# By Henrik Nyh <http://henrik.nyh.se> 2009-01-29 under the MIT license. | |
require 'date' | |
module Personnummer | |
def self.generate(date=nil, serial=nil) | |
date ||= Date.new(1900+rand(100), 1+rand(12), 1+rand(28)) | |
serial = serial ? serial.to_s : format("%03d", 1+rand(999)) # 001-999 |
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
namespace identity.Controllers | |
open System | |
open System.Collections.Generic | |
open System.Linq | |
open System.Threading.Tasks | |
open Microsoft.AspNetCore.Mvc | |
[<Route("api/[controller]")>] | |
[<ApiController>] |
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 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 |
NewerOlder