google / google/haskell-indexer

Emit proper types

Open
#31 1 comment 0 reactions 0 assignees View on GitHub
missing-xref
Dominant language
Haskell
Stars
103
Forks
19
PR merge metrics
No merged PRs in 30d

Description

Now the type support in Translate layer is pretty weak (strings), and non-existent in Kythe frontend.

We should expose a stripped-down type to the Translate layer. Approximately able to represent `forall a (b :: k) . (Ctx a, Foo a b) => [...] -> [...] -> [...]`.

## Kythe schema mapping (work-in-progress)

### Constrained function.

`Foo a b => a -> b`:

- `abs Avar Bvar`
- child: `tapp constr#1fn#2 vname(b) vname(Foo) vname(a)`.

Note that Kythe schema convention expects return type to be first parameter.

Also, `Avar` and `Bvar` are new `absvars` bound by the (implicit) foralls. So generally two functions `foo :: a -> a` and `bar :: a -> a` won't have the same Kythe type vname, since the absvars will differ. We gave some thought to this, and realized that full proper type-level querying likely needs a separate index, so we won't stress to fit all the abstract details into the Kythe schema.

We choose to fake constraints as additional parameters until Kythe has better support for them. Note that this is can result of things having different types depending on the Constraint tuple order. But since polymorphic things will generally have separate Kythe type vname anyway, this is not a big loss.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.