• Kim Nguyễn's avatar
    Further improve the pretty printing with the following algorithm. · 89a5e61c
    Kim Nguyễn authored
    Given a type for which each kind is i DNF :
    
    ints: \/ /\a /\v /\~b /\~w
    chars: \/ /\a /\v /\~b /\~w
    ...
    
    where a, b are atoms and v w toplevel variables, index the type by
    pairs of variables, for each kind, which gives a matrix of 8 lines.
                        ...   (v, w) ...   (x,y) ...
    ints:                      t1           t1
    chars:                     ...         ...
    atoms:
    times:
    xml:
    arrow:
    record:
    abstract:                  t8           t8
    
    let T = t1 | ... | t8,
    we can write ((v & w) | (x & y)) & T
    we now try to factor according to variables (intersection of v x and w y)
    to have a type of the form: ('a | ... | 'd) & 'e ... & (Any \ 'f) & T
    89a5e61c
types.ml 111 KB