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

ocamldoc doesn't preserve type contraints and _, producing unreadable interfaces #5067

Closed
vicuna opened this issue Jun 5, 2010 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Jun 5, 2010

Original bug ID: 5067
Reporter: bluestorm
Status: confirmed (set by @gasche on 2016-04-18T18:39:06Z)
Resolution: open
Priority: normal
Severity: text
Target version: 4.07.0+dev/beta2/rc1/rc2
Category: ocamldoc
Related to: #5294
Monitored by: @gasche "Julien Signoles"

Bug description

Ocamldoc doesn't preserve type constaints (type .. = ... constraint ..) and type placeholders in values (val foo : .. -> _) : they are resolved during type inference, and ocamldoc gives back the fully detailed types wich are sometimes unreadable.

It would be very nice to have an option to reuse the type information present in the .mli without additional inference.

Additional information

In [Macaque], I use a lot of phantom types carrying multiple type informations : I use object types as a type-level record, wich leads to quite heavy datatypes. I use the "constraint" feature and "_" for values specifications to have a readable [interface]. For example :

type 'phant binary_op = 'a t -> 'b t -> 'c t
constraint 'a = < t : 'in_t; nul : 'n; .. >
constraint 'b = < t : 'in_t; nul : 'n; .. >
constraint 'c = < t : 'out_t; nul : 'n >
constraint 'phant =
< in_t : 'in_t; out_t : 'out_t; nul : 'n; a : 'a; b : 'b >

type 'phant arith_op = 'phant binary_op
constraint 'phant = < in_t : #numeric_t as 't; out_t : 't; .. >

val (+) : _ arith_op
val (-) : _ arith_op
val (/) : _ arith_op
val ( * ) : _ arith_op

My problem is that ocamldoc produces utterly unreadable results :

type < a : < nul : 'a; t : 'b; .. >; b : < nul : 'a; t : 'b; .. >; in_t : 'b;
nul : 'a; out_t : 'c > binary_op = (< nul : 'a; t : 'b; .. > as 'd) t ->
(< nul : 'a; t : 'b; .. > as 'e) t -> < nul : 'a; t : 'c > t

type < a : < nul : 'a; t : #Sql.numeric_t as 'b; .. >;
b : < nul : 'a; t : 'b; .. >; in_t : 'b; nul : 'a; out_t : 'b >
arith_op = < a : < nul : 'a; t : 'b; .. > as 'c; b : < nul : 'a; t : 'b; .. > as 'd;
in_t : 'b; nul : 'a; out_t : 'b >
Sql.binary_op

val (+) : < a : < nul : 'a; t : #Sql.numeric_t as 'b; .. >;
b : < nul : 'a; t : 'b; .. >; in_t : 'b; nul : 'a; out_t : 'b >
arith_op

[Macaque] http://macaque.forge.ocamlcore.org/
[interface] http://darcs.ocamlcore.org/cgi-bin/darcsweb.cgi?r=macaque;a=plainblob;f=/src/sql.mli

@github-actions
Copy link

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

@github-actions github-actions bot added the Stale label May 15, 2020
@gasche
Copy link
Member

gasche commented May 15, 2020

I filed this issue ten years ago, and it is pretty clear to me that ocamldoc is not going to get radical improvements in the future, only easier incremental fixes. Maybe odoc will be able to handle this better. Closing.

@gasche gasche closed this as completed May 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants