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

Allow arguments of derivers to have default values #405

Open
panglesd opened this issue Mar 23, 2023 · 1 comment
Open

Allow arguments of derivers to have default values #405

panglesd opened this issue Mar 23, 2023 · 1 comment

Comments

@panglesd
Copy link
Collaborator

Deriving arguments are always extracted as options, or bool: see the two function creating arguments: arg and flag.

It could be nice to add a function to have an argument with a default value, to avoid handling the default case in the main function, as in let arg = match arg with Some v -> v | None -> default_value in (reported by @sim642, see ocaml-ppx/ppx_deriving#263 (comment)).

The added function would be:

val arg_default : 
  string ->
  (expression, 'a -> 'a, 'a) Ast_pattern.t ->
  default:'a ->
  'a param
@panglesd
Copy link
Collaborator Author

@Annosha is working on this one

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

1 participant