This file contains hidden or 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
| #lang racket | |
| (define empty-stream | |
| (lambda () null)) | |
| ;явно заворачиваем в лямбду | |
| (define (stream-cons x xs) | |
| (lambda () (cons x xs))) | |
| (define (stream-empty? xs) |
This file contains hidden or 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
| #lang racket | |
| (require racket/match) | |
| (provide (all-defined-out)) | |
| (define (list-nth xs n) | |
| (if (= n 0) | |
| (car xs) | |
| (list-nth (cdr xs) (- n 1)))) |
This file contains hidden or 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 Api.App | |
| open System | |
| open System.IO | |
| open Microsoft.AspNetCore.Builder | |
| open Microsoft.AspNetCore.Cors.Infrastructure | |
| open Microsoft.AspNetCore.Hosting | |
| open Microsoft.Extensions.Logging | |
| open Microsoft.Extensions.DependencyInjection | |
| open Giraffe |
This file contains hidden or 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 EnumLikeDuConverter = | |
| open Newtonsoft.Json | |
| open Microsoft.FSharp.Reflection | |
| open System.Collections.Concurrent | |
| open Newtonsoft.Json.Linq | |
| /// see `enumLikeDuConverter` | |
| type EnumLikeDuConverter() = |
This file contains hidden or 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.FSharp.Quotations.Patterns | |
| open System.Reflection | |
| let nullTraverse<'a> (expr: Quotations.Expr<'a>) (originObj : obj) : 'a option = | |
| let inline tryGet (p : PropertyInfo) o = | |
| p.GetMethod.Invoke(o,null) | |
| |> Option.ofObj | |
| let rec innerTraverse (nullableObj : obj) = function | |
| | PropertyGet(None, props, _) -> tryGet props obj |
This file contains hidden or 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 optionBuilder() = | |
| member __.Bind(opt, f) = Option.bind f opt | |
| member __.Bind(obj, f) = Option.bind f (Option.ofObj obj) | |
| member __.Bind(obj, f) = Option.bind f (Option.ofObj (box obj)) | |
| member __.Bind(obj, f) = Option.bind f (Option.ofNullable obj) | |
| member __.Return x = Some x | |
| member __.ReturnFrom x = x | |
| let option = optionBuilder() |
This file contains hidden or 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 Cardone.Backoffice.ImageSearch.Extensions.Installers | |
| open Microsoft.Extensions.DependencyInjection | |
| open Microsoft.AspNetCore.Mvc | |
| open Newtonsoft.Json.Serialization | |
| open Newtonsoft.Json | |
| open Newtonsoft.Json.Converters | |
| open Microsoft.AspNetCore.Routing | |
| open System.IO | |
| open Microsoft.AspNetCore.DataProtection |
This file contains hidden or 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 Infrastructure.Web.Api.Mvc | |
| open Microsoft.AspNetCore.Mvc.Filters | |
| open Microsoft.Extensions.Logging | |
| open Infrastructure.Web.Api.Localization | |
| open System | |
| open Microsoft.AspNetCore.Mvc | |
| let (|NotNull|) name = function | |
| | null -> nullArg name | |
| | o -> o |
This file contains hidden or 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 | |
| let inline (^) f x = f x | |
| let processUpdate context = | |
| context.Update.Message | |
| |> Option.iter ^fun message -> | |
| message.Entities | |
| |> Option.filter ^Seq.exists ^fun x -> x.Type = "url" | |
| |> Option.iter ^fun _ -> |
This file contains hidden or 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 Hopac | |
| open Hopac.Infixes | |
| open Hopac.Stream | |
| /// This is concurrent pool of workers with constant `degree` of parallelism | |
| /// | |
| /// Used in `Hopac.Stream.mapPipelinedJob` as temporary workaround before [this](https://github.com/Hopac/Hopac/pull/186) will be released | |
| type Pool<'i,'o>(worker: 'i -> Job<'o>, degree) = | |
| let inputCh, degreeCh, doneCh = Ch(), Ch(), Ch() |