8000 Feature to prevent throwback of type definitions · Issue #282 · realworldocaml/mdx · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Feature to prevent throwback of type definitions #282

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

Open
yminsky opened this issue Aug 8, 2020 · 0 comments
Open

Feature to prevent throwback of type definitions #282

yminsky opened this issue Aug 8, 2020 · 0 comments
Labels
Kind/Feature-request New feature or request
Milestone

Comments

@yminsky
Copy link
Member
yminsky commented Aug 8, 2020

Right now, in Real World OCaml, every type definition is thrown back to the user, which is no what you want typically, since the type definition itself contains essentially the same information. It would be useful to have some flags to control this behavior, both on a block-by-block basis, and flags to set defaults at the tool invocation level, so we can set broad defaults.

I can think of three modes that would make sense to switch between.

  • Suppress nothing, which is the current behavior
  • Suppress types, suppress the restatement of top-level type-definitions only
  • Suppress all signatures, which would include val and module declarations. This would still let printed values through.

In all of the above, type errors should still come through. Note that in the case of type definitions with deriving clauses, like this one:

type t = int * int [@@deriving sexp

that one should expect the following in suppress-types mode:

val sexp_of_t : t -> Sexp.t
val t_of_sexp : Sexp.t -> t

i.e., the derived value declarations should come through, but not the types.

I propose that module declarations make it through in suppress-types mode, even if those modules contain only types.

Note that something close to the "suppress all" behavior is available by dropping the # syntax. But it would be good to have this control while still keeping the basic syntax. Indeed, in suppress types mode, it would be useful to have some lines that are type definitions and some that are value declarations in the same block, and have their behavior vary as suggested above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Kind/Feature-request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0