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 Customer = { | |
Id : int | |
IsVip : bool | |
Credit : decimal | |
} | |
type GetPurchasesError = | |
| HasOddId of int | |
type IncreaseCreditIfVipError = |
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 System | |
open System.IO | |
open Microsoft.AspNetCore.Builder | |
open Microsoft.AspNetCore.Hosting | |
open Microsoft.Extensions.Hosting | |
open Microsoft.Extensions.DependencyInjection | |
open Microsoft.AspNetCore.Http | |
open Giraffe | |
open Giraffe.ViewEngine | |
open FSharp.Control.Tasks |
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 System | |
open System.IO | |
open Microsoft.AspNetCore.Builder | |
open Microsoft.AspNetCore.Hosting | |
open Microsoft.Extensions.Hosting | |
open Microsoft.Extensions.DependencyInjection | |
open Microsoft.AspNetCore.Http | |
open Giraffe | |
open Giraffe.ViewEngine | |
open FSharp.Control.Tasks |
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 Microsoft.AspNetCore.Builder | |
open Microsoft.AspNetCore.Hosting | |
open Microsoft.Extensions.Hosting | |
open Microsoft.Extensions.DependencyInjection | |
open Microsoft.AspNetCore.Http | |
open Giraffe | |
open Giraffe.iewEngine | |
open FSharp.Control.Tasks | |
type PingModel = { |
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 getResponse body (cookie: string option) (client:HttpClient) = | |
task { | |
return! | |
Http.createPostRequest Url | |
|> withBody (RequestBody.Xml body) | |
|> fun req -> | |
match cookie with | |
| Some c -> withCookie c req | |
| _ -> req | |
|> Http.execute client |
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 ComputationExpression | |
module AsyncResultDemo = | |
open System | |
open FsToolkit.ErrorHandling | |
type AuthError = | |
| UserBannedOrSuspended |
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 Microsoft.AspNetCore.Builder | |
open Microsoft.AspNetCore.Hosting | |
open Microsoft.Extensions.Hosting | |
open Microsoft.Extensions.DependencyInjection | |
open Microsoft.AspNetCore.Http | |
open Giraffe | |
open Giraffe.ViewEngine | |
open FSharp.Control.Tasks | |
type PingModel = { |
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
// Created in Linqpad | |
void Main() | |
{ | |
// 'baaaa' = -1 | |
// 'dog' = 8 | |
// 'aabab' = 3 -> 'aa' + 'ba' + 'b' | |
// 'aabaa' = 0 -> 'aa' + 'baa' | |
// 'adoag' = 6 -> 'a' + 'd' + 'oa' + 'g' | |
calculate("baaaa").Dump(); | |
calculate("dog").Dump(); |