Hi Rob,
Pretty printing of datatypes changed some years ago; I can't remember exactly when.

Originally all the printing was done at run-time but that meant that the type information and all the environments had to be reachable at run-time. That could be very large. I changed it so that a default print function was generated for a datatype when the datatype was declared. I have a feeling that the old version did indeed handle infix constructors but that could have been removed.

Regards,
David

On 31/10/2024 21:42, Rob Arthan wrote:
Dear All,

I am trying re-use some demo code that I wrote some years ago and am getting 
different output from what I previously got.

A cut-down version of the code is as follows:

local
   datatype THEOREM = D of (int * int);
in
   type THEOREM = THEOREM;
   infix D;
   fun axiom m = if m <> 0 then m D m else raise NOT_ALLOWED;
end;
axiom 1;

The output I used to get was:

infix 0 D
eqtype THEOREM
val axiom = fn: int -> THEOREM
val it = 1 D 1: THEOREM

The output I now get is:

infix 0 D
eqtype THEOREM
val axiom = fn: int -> THEOREM
val it = D (1, 1): THEOREM

Can I do something to persuade the pretty-printer to use infix notation for the 
constructor D?
(In a real application, I would install my own pretty-printer for the type 
THEOREM, but that
would be an annoying distraction in the talk that the demo code accompanies.)

Regards,

Rob.


_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml
_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to