next-generation programming platform, currently in development
about
swag

Twitter . GitHub . RSS

New parser, better errors



Hey folks, Rúnar here. I just wanted to give a quick update on our progress over the past couple of weeks. We’re hard at work getting Unison towards a preview release. Here are some highlights:

lookit

So that’s what we have been doing. Here’s what we’re up to right now:

Type-directed name resolution

Unison will disambiguate overloaded names based on the expected type at the usage site. When there are multiple things in scope with the same name and you use that name unqualified, Unison will try to figure out which one you meant. If only one of the options typechecks, Unison will just use that one. If more than one typechecks, it will ask you to disambiguate. This mechanism incidentally gives us typed holes for free.

Improved error messages

After changing the way type errors are represented, there’s still a bit of work remaning to render those errors nicely to the programmer. We feel that this is really important to the overall developer experience, so we’re trying to be thoughtful about how we present errors.

Programming languages generally give really terrible error messages, and we want Unison’s errors to read more like a human explaining to you what went wrong, hopefully illuminating the steps you have to take to correct the program. We want to shed the cultural baggage that’s reminiscent of when computers only had one kilobyte of memory and a robotic “SYNTAX ERROR LINE 20” was basically the best you could hope for. In providing feedback to the programmer, languages have not come a very long way since the 1980s. Anyway, it’s time to fix that.

Effect inference

We have implemented Algebraic Effects based on the Frank language. But Frank expressly doesn’t have effect inference. That is, it has type inference, but it will never infer an effect as part of a type, so you have to give type annotations whenever you want a function to be effectful. We’ve found that this isn’t very ergonomic for the programmer, so we’re currently trying to implement an algorithm for inferring effect types.

That’s all for now. We’ll have more updates for you in a couple of weeks.

comments powered by Disqus