Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with symbolic/infix constructors in data declarations #132

Closed
sheaf opened this issue Apr 28, 2020 · 2 comments
Closed

Issues with symbolic/infix constructors in data declarations #132

sheaf opened this issue Apr 28, 2020 · 2 comments
Labels

Comments

@sheaf
Copy link
Collaborator

sheaf commented Apr 28, 2020

The following causes the extension quite a bit of trouble

data C a b = C a b
data a `D` b = a `D` b
data a `E` b where

data (:>) a b = (:>) a b
data a :< b = a :< b
data a := b = a := b
data (:<>) a b where
  (:<>) :: a -> b -> (:<>) a b
data a :>< b where

type F a b = C a b
type a `G` b = a `D` b

type (:>>) a b = a :> b
type a :<< b = a :< b
type a :== b = a := b

symbolic_data_cons_highlighting

@sheaf
Copy link
Collaborator Author

sheaf commented Apr 29, 2020

I think the most important is to get the following two scopes right

  • storage.type.haskell, applies to non-reserved identifiers in a type context starting with a capital letter (prefix and infix) or any allowed symbol (not necessarily :)
    data C a b
    data a `D` b
    type E a b = F a b
    type a `G` b = a `H` b
    data a :+: b
    type a :<>: b = a :& b
    type a <.> b = a <!> b
  • constant.other.haskell applies to non-reserved identifiers in a value context starting with a capital letter (prefix or infix) or the symbol :
data X a b = D a b
data Y a b = (:>) a b
data Z a b = a :& b

Less importantly, additional scopes can be added for the infix forms, something along the lines of:

  1. operator.custom.haskell for symbolic operators in a value context that do not start with :,
  2. type.operator.custom.haskell for any symbolic operator in a type context,
  3. constant.custom.haskell (or some other suggestion) for symbolic constructors, i.e. non-reserved symbolic identifiers at the value level that start with :,
  4. type.operator.infix.haskell and constant.infix.haskell for infix applications of identifiers starting with a capital letter, at the type and value level respectively.

@sheaf sheaf added the bug label May 1, 2020
@sheaf
Copy link
Collaborator Author

sheaf commented May 6, 2020

Fixed with 34df8d0 and 7217f36. I'm quite happy as I think this is very helpful for newcomers, to highlight the type and the constructor differently even though they might have the same name.

@sheaf sheaf closed this as completed May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant