Skip to content

Handle value declarations better

We are still very close to the compiler's AST. When we get a full value, it comes in many pieces. For example:

f :: Maybe ~> List
f (Just x) = [x]
f Nothing = []

would end up as something like [Type, Value, Value]. When we format that, we end up with some awkwardness:

f ::
  Maybe
    ~> List
f (Just x) = [ x
             ]

f Nothing = []

There's a line between the first value declaration and the second because they're different value declarations (as parsed) and we always put a line after a value declaration.

What we should do is make another pass on the AST to transform it to something like [(Maybe Type, NonEmpty Value)]. Then, we ought to be able to handle multi-line values better. Should also make formatting types easier, as we do some unclear things to make them work.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information