google-research / google-research/dex-lang
No support for polymorphism over record fields
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 117
- PR merge metrics
- No merged PRs in 30d
Description
My simplex demo needs an ```Eq``` instance for a particular record type. I managed to make one by hand, but is it possible in the current codebase to make a generic constructor of ```Eq``` or other typeclasses for records?
For example, here's the instance for ```Eq``` for pairs:
```
@instance
def pairEq (eqA: Eq a)?=> (eqB: Eq b)?=> : Eq (a & b) = MkEq $
\(x1,x2) (y1,y2). x1 == y1 && x2 == y2
```
I started trying to write an analogous one for records, but because I can't refer to the names of the fields explicitly (or somehow quantify over them), I think it's impossible.
Contributor guide
Research direction
No file, test, or entry point is named. Start by clarifying whether record-field polymorphism and generic Eq or other typeclass construction are intended language features, then define the expected behavior for records before locating the relevant implementation and tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100