... | ... | @@ -23,18 +23,7 @@ See [separate notes of the implementation of DuplicateRecordFields](records/over |
|
|
## 2. The `OverloadedLabels` extension
|
|
|
|
|
|
|
|
|
This part is new in the 2015 redesign The implementation is fairly straightforward and close to (but simpler than) the existing `ImplicitParameters` extension. The key points:
|
|
|
|
|
|
- We extend the lexer to treat `#x` as a single lexeme (only when `OverloadedLabels` is enabled) and parse it into a new constructor `HsOverLabel "x"` of `HsSyn`.
|
|
|
|
|
|
- A new module `GHC.OverloadedLabels` defines the (renamed) `IV` class
|
|
|
|
|
|
```wiki
|
|
|
class OverloadedLabel (x :: Symbol) a where
|
|
|
overloadedLabel :: a
|
|
|
```
|
|
|
|
|
|
- When the typechecker sees `HsOverLabel "x"`, it emits a new wanted constraint `OverloadedLabel "x" alpha`, just like `HsIPVar`.
|
|
|
See [separate notes of the implementation of OverloadedLabels](records/overloaded-record-fields/overloaded-labels#implementation).
|
|
|
|
|
|
## 3. The magic type classes
|
|
|
|
... | ... | |