hydromatic / morel

Standard ML interpreter, with relational extensions, implemented in Java
Apache License 2.0
291 stars 15 forks source link

Fold long types when printing #210

Closed julianhyde closed 6 months ago

julianhyde commented 6 months ago

Long type descriptors should fold over multiple lines if they exceed the line width. For example, in smlnj:

- Control.Print.linewidth := 40;
val it = () : unit
- val x = [[1,2,3], [4,5], [6], []];
val x = [[1,2,3],[4,5],[6],[]] : int list list
- val y = ([1,2,3], [4,5], [6], []);
val y = ([1,2,3],[4,5],[6],[])
  : int list * int list * int list * 
    'a list
- val z = {a=[1,2,3], b=[4,5], c=[6], d=()};
val z = {a=[1,2,3],b=[4,5],c=[6],d=()}
  : {a:int list, b:int list,
     c:int list, d:unit}
- val r = {x=x,y=y,z=z};
val r =
  {x=[[1,2,3],[4,5],[6],[]],
   y=([1,2,3],[4,5],[6],[]),
   z={a=[1,2,3],b=[4,5],c=[6],d=()}}
  : {x:int list list,
     y:int list * int list * int list
       * 'a list,
     z:{a:int list, b:int list,
        c:int list, d:unit}}

Currently Morel folds the value but not the type:

val r =
  {x=[[1,2,3],[4,5],[6],[]],
   y=([1,2,3],[4,5],[6],[]),
   z={a=[1,2,3],b=[4,5],c=[6],d=()}}
  : {x:int list list, y:int list * int list * int list * 'a list, z:{a:int list, b:int list, c:int list, d:unit}}