Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Haskell] Fix data constructor definitions (#3241)
This PR addresses some points from #3227. 1. It reorganizes prelude type/constant scopes, so `Just`, `Nothing`, `Left` and `Right` are highlighted consistently. 2. It scopes data constructors in data declarations `entity.name.constant`. 3. As a preparation for 2.) the strategy to handle `[context] =>` expresssions in class/data/newtype/type declarations had to be changed a bit to (more) reliably. It is mainly required to detect the beginning of data constructor expressions (`= Constr`), but also helps with some edge cases in the other declarations. Note: This PR does not scope data types and data constructors differently in normal statements/expressions as no reliable strategy hasn't been found to do so. * [Haskell] Reorganize and add prelude type and data constructors According to Haskell's wording ... - type constructors are scoped `support.type`, `storage.type` Type constructors without parameters are called "type". - data constructors are scoped `support.constant`, `constant.other` Data constructors without parameters are called "constant". Data constructors denote first class values. As such they can be assigned to variables etc. See: https://wiki.haskell.org/Constructor * [Haskell] Reorganize class identifier contexts Merge class and type contexts as it is not possible to reliably distinguish both in all situations anyway. The common scope `storage.type` ensures same highlighting under all circumstances. * [Haskell] Improve declaration context This commit... 1. adds some infrastructure to make sure to correctly match `[context] =>` patterns in class/instance/data/type/newtype declarations. It's required to reliably match the beginning of data constructors. 2. removes `entity.name.class` scoping from instance declarations as this was semantically wrong. * [Haskell] Improve deriving expression This commit limits fully qualified data type matching to 1 after `deriving` keywords, in case they are not surrounded by parens. More reliably pop as soon as possible. * [Haskell] Fix data constructor definitions This commit adds data constructor expressions in order to 1. scope constructors `entity.name.constructor` in declarations. 2. add declared constructor names to Symbol List. 3. enable "Goto Definition" It should improve readability of constructor expressions as the declared constructor may be tinted differently then the following types which define its signature.
- Loading branch information