Skip to content

Rightward drift in deep function application #62

@shwestrick

Description

@shwestrick

This output has a too much rightward drift in the first branch:

fun filterIdx p s =
  case s of
    Flat (Full slice) =>
      Flat
        (Full
           (AS.full
              (SeqBasis.filter gran (0, AS.length slice) (AS.nth slice)
                 (fn k => p (k, AS.nth slice k)))))

  | Flat (Delay (i, j, f)) =>
      Flat (Full (AS.full (SeqBasis.filter gran (i, j) f (fn k => p (k, f k)))))

  | _ => filterIdx p (force s)

If we increase the max width to 100, it becomes more reasonable again:

fun filterIdx p s =
  case s of
    Flat (Full slice) =>
      Flat (Full (AS.full (SeqBasis.filter gran (0, AS.length slice) (AS.nth slice) (fn k =>
        p (k, AS.nth slice k)))))

  | Flat (Delay (i, j, f)) =>
      Flat (Full (AS.full (SeqBasis.filter gran (i, j) f (fn k => p (k, f k)))))

  | _ => filterIdx p (force s)

To fix this, I think "splittable expressions" need to be generalized to handle multiple possible splits...

Metadata

Metadata

Assignees

No one assigned

    Labels

    aestheticsImprovement to code formatter output

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions