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

[@fmt "%d"] as a shorthand to [@printer fun fmt -> fprintf fmt "%d"] #190

Open
XVilka opened this issue Jun 3, 2019 · 2 comments
Open

Comments

@XVilka
Copy link
Contributor

XVilka commented Jun 3, 2019

Add the new attribute so

[@printer fun fmt -> fprintf fmt "%d"]

would become

[@fmt "%d"]

Well, the reason is quite obvious, just to be type more while the case is quite common, I believe.

@gasche
Copy link
Contributor

gasche commented Jun 3, 2019

Another approach would be for you to declare a local function

let fmt format = fun ppf -> Printf.fprintf ppf format

and use [@printer fmt "%d"].

@XVilka
Copy link
Contributor Author

XVilka commented Jun 3, 2019

@gasche it is what I did exactly, but it is still less concise than my suggestion.

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

No branches or pull requests

2 participants