ui-core icon indicating copy to clipboard operation
ui-core copied to clipboard

Render builtin types with type variables

Open hojberg opened this issue 4 years ago • 1 comments

There's a very specific set of builtin types in Unison and we can render them more nicely than builtin type. For instance, base.List could be rendered as type List a (or perhaps builtin type List a). Showing type variables helps communicate how the builtins are constructed.

The full list of builtins are here: https://github.com/unisonweb/unison/blob/trunk/parser-typechecker/src/Unison/Builtin.hs#L153

Of those, these are the ones with type variables:

  • type MVar a
  • type TVar a
  • type Ref {g} a
  • ability Scope s
  • type Request {g} r
  • type List a

We can hard code this rendering in the UI for now. Note that builtins have special hashes: like ##Nat for instance.

hojberg avatar Oct 06 '21 03:10 hojberg

After working with this for a bit, I'm starting to reconsider that this should exist in the UI. Essentially the syntax being generated are like type "summaries" (see https://github.com/unisonweb/unison/issues/2175), and implementing this as such in the backend seems like a better approach.

hojberg avatar Oct 08 '21 19:10 hojberg