{"id":26939963,"url":"https://github.com/RealmPlume/Kinniku.FSharp.FunctionUncovering","last_synced_at":"2025-04-02T15:15:39.108Z","repository":{"id":144160325,"uuid":"265279960","full_name":"RealmPlume/Kinniku.FSharp.FunctionUncovering","owner":"RealmPlume","description":"Function automatic inference execution","archived":false,"fork":false,"pushed_at":"2020-05-20T03:09:45.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T13:51:41.008Z","etag":null,"topics":["fsharp"],"latest_commit_sha":null,"homepage":null,"language":"F#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RealmPlume.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-19T15:04:00.000Z","updated_at":"2020-05-20T03:09:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"348911fa-cf90-4077-94b3-4cfeabbd8f17","html_url":"https://github.com/RealmPlume/Kinniku.FSharp.FunctionUncovering","commit_stats":null,"previous_names":["greatim/kinniku.fsharp.functionuncovers","realmplume/kinniku.fsharp.functionuncovering"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealmPlume%2FKinniku.FSharp.FunctionUncovering","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealmPlume%2FKinniku.FSharp.FunctionUncovering/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealmPlume%2FKinniku.FSharp.FunctionUncovering/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RealmPlume%2FKinniku.FSharp.FunctionUncovering/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RealmPlume","download_url":"https://codeload.github.com/RealmPlume/Kinniku.FSharp.FunctionUncovering/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246837683,"owners_count":20841903,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fsharp"],"created_at":"2025-04-02T15:15:37.228Z","updated_at":"2025-04-02T15:15:39.103Z","avatar_url":"https://github.com/RealmPlume.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NuGet](https://img.shields.io/nuget/v/Kinniku.FSharp.FunctionUncovers.svg)](https://www.nuget.org/packages/Kinniku.FSharp.FunctionUncovers/)\n## About\n\nThis is a single-file project that implements some function base on\n[Statically Resolved Type Parameters](https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/generics/statically-resolved-type-parameters)\nfor handle currying function in F#.\n\nIt is free and unencumbered software released into the public domain.\n\n## Usage:\n\n You can use it to convert a currying function to a currying `System.Func`.\n\n```fsharp\nopen System\nopen System.Runtime.CompilerServices\nopen Kinniku.FSharp.FunctionUncovers\n\n[\u003cExtension\u003e]\ntype Test =\n    [\u003cExtension\u003e]\n    static member Currying(fn: Func\u003c_,_,_,_\u003e) =\n        // Generate a currying `System.Func`\n        CurryingFunc\u003c_,_\u003e.Inject(fun a b c -\u003e fn.Invoke(a, b, c))\n\n    [\u003cExtension\u003e]\n    static member Currying(fn: Action\u003c_,_,_\u003e) =\n        // Generate a currying Delegate end with `System.Action`\n        CurryingFunc\u003c_\u003e.Inject(fun a b c -\u003e fn.Invoke(a, b, c))        \n\n```\n\nOr you can get a function return type, and bind it to a function's\nargument. \n\n```fsharp\nmodule Test2 =\n    open System\n    open Kinniku.FSharp.FunctionUncovers\n\n    let foo (n: int)  = {| Value = string n |}\n\n    // The `handle`'s argument is the return type of `foo`.\n    let handle (ResultOf foo x) =  x.Value\n\n\n    let foo2 (a: int) (b: string) (c: DateTime) = \n        {| A = a; B = b; C = c |}\n\n    // The `handle`'s argument is the return type of `foo2`. And `foo2` is a currying function.\n    let handle2 x =        \n        let inline fn() = FuncTest\u003c_\u003e.Inject foo2\n        let (ResultOf fn x) = x\n        x.A\n\n```\n\nAnd then you can use it to build your lite dependency injection serve too.\n\n```fsharp\nmodule Test3 =\n    open System\n    open Kinniku.FSharp.FunctionUncovers\n\n    // Write you instance provider, it provide the instance with static methods name with `GetInstance`, and they has one argument, \n    // it's type equals the return type.\n    type Instances = \n\n        | Instances\n\n        static member GetInstance(_: int) = 1\n\n        static member GetInstance(_: int64) = 2L\n\n        static member GetInstance(_: string) = \"AH\"\n\n        static member GetInstance(_: DateTime) = DateTime.Now\n\n    // `foo` is the function whitch to be injected with instance.\n    let foo (a: int) (b: int64) (c: DateTime) (d: string)= \n        printf \"a: %d\\nb: %d\\nc: %A\\nd: %s\" a b c d\n\n    // Run `foo` and inject my instances.\n    let serveFunc () = \n        Dependency\u003c_,_\u003e.Inject(foo, Instances) // parse a default value to bind the instance provider\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRealmPlume%2FKinniku.FSharp.FunctionUncovering","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRealmPlume%2FKinniku.FSharp.FunctionUncovering","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRealmPlume%2FKinniku.FSharp.FunctionUncovering/lists"}