-
Notifications
You must be signed in to change notification settings - Fork 54
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
C#-friendly api #318
C#-friendly api #318
Conversation
* Use C#-style OptionalAttribute instead of F#-style optional arguments * Use Func and Action instead of F# functions
* Use C#-style OptionalAttribute instead of F#-style optional arguments
* Use Func instead of F# function
ec2eee6
to
8908ffc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
this.MapFallback(fun ctx -> | ||
let page = page ctx | ||
let page = page.Invoke(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let page = page.Invoke(ctx) | |
let page = page.Invoke ctx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestions! I actually tend to prefer parenthesized syntax for methods though, even if they're single-argument.
| None -> serOptions.Converters.Add(JsonFSharpConverter()) | ||
| Some f -> f serOptions } | ||
| null -> serOptions.Converters.Add(JsonFSharpConverter()) | ||
| f -> f.Invoke(serOptions) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| f -> f.Invoke(serOptions) } | |
| f -> f.Invoke serOptions } |
Fixes #313. (cc @xperiandri)
Use OptionalAttribute, Func and Action instead of F#-style optional parameters and functions to provide a more C#-friendly API.
This should be a source-compatible change for most users; however, it will break explicit uses of
?paramName = optionValue
, and possibly some type inference scenarios for function arguments.