Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FS-1045] Add FuncConvert.FromFunc, FuncConvert.FromAction APIs #4815

Merged
merged 9 commits into from
May 25, 2018

Conversation

dsyme
Copy link
Contributor

@dsyme dsyme commented May 2, 2018

Continuation of #3013 (comment)

RFC https://github.com/fsharp/fslang-design/blob/master/RFCs/FS-1045-func-to-fsharpfunc-overloads.md

Addresses #1847 - ToFSharpFunc(Func) missing in .NET Core.

Adds

type FuncConvert = 
    static member  inline ToFSharpFunc       : func:Func<'T,'U>          -> ('T -> 'U)
    static member  inline ToFSharpFunc       : func:Func<'T1,'T2,'U>          -> ('T1 * 'T2 -> 'U)
    static member  inline ToFSharpFunc       : func:Func<'T1,'T2,'T3,'U>          -> ('T1 * 'T2 * 'T3 -> 'U)
    static member  inline ToFSharpFunc       : func:Func<'T1,'T2,'T3,'T4,'U>          -> ('T1 * 'T2 * 'T3 * 'T4 -> 'U)
    static member  inline ToFSharpFunc       : func:Func<'T1,'T2,'T3,'T4,'T5,'U>          -> ('T1 * 'T2 * 'T3 * 'T4 * 'T5 -> 'U)
    static member  inline ToFSharpFunc       : func:Func<'T1,'T2,'T3,'T4,'T5,'T6,'U>          -> ('T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 -> 'U)
    static member  inline ToFSharpFunc       : func:Func<'T1,'T2,'T3,'T4,'T5,'T6,'T7,'U>          -> ('T1 * 'T2 * 'T3 * 'T4 * 'T5 * 'T6 * 'T7 -> 'U)

There was no good way to create an FSharpFunc object from C# on .NET core with a method call.

@dsyme
Copy link
Contributor Author

dsyme commented May 2, 2018

I have updated the RFC linked above to cover the updated changes in this PR.

E

@dsyme dsyme changed the title [FS-1045] F# 4.x: Add ToFSharpFunc overloads for Func<...>, especially for .NET Core [FS-1045] Add FuncConvert.FromFunc, FuncConvert.FromAction APIs, especially for .NET Core May 2, 2018
@dsyme dsyme changed the title [FS-1045] Add FuncConvert.FromFunc, FuncConvert.FromAction APIs, especially for .NET Core [FS-1045] Add FuncConvert.FromFunc, FuncConvert.FromAction APIs May 2, 2018
@dsyme
Copy link
Contributor Author

dsyme commented May 4, 2018

@brettfo @KevinRansom Should updates to FSharp.Core target dev15.8 or master? Thanks

@brettfo
Copy link
Member

brettfo commented May 4, 2018

@dsyme I would say master. We're currently flowing all changes from master into dev15.8 (this will be disabled as we try to stabilize 15.8 at the divisional level), but we're not flowing anything from dev15.8 to master.

@KevinRansom KevinRansom changed the base branch from master to dev15.8 May 8, 2018 00:20
@KevinRansom
Copy link
Member

Targeting dev15.8

@mdinger
Copy link

mdinger commented May 15, 2018

Not to say this is a bad approach but I've found this usage of invoke leads me to deadlocks when working with async f# with no obvious alternative. Shouldn't there be async friendly alternatives too?

@cartermp cartermp added this to the 15.8 milestone May 20, 2018
@KevinRansom KevinRansom merged commit 6a73326 into dotnet:dev15.8 May 25, 2018
KevinRansom pushed a commit to KevinRansom/fsharp that referenced this pull request May 26, 2018
…et#4815)

* add func overloads

* adjust based on C# testing

* fix test break

* fix test

* update surface area

* fix test

* align inlines

* Merge error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants