@@ -3,15 +3,13 @@
33
44 (integer) @constant.numeric.integer
55 (exp_negation) @constant.numeric.integer
6− (exp_literal (float)) @constant.numeric.float
6+ (exp_literal (number)) @constant.numeric.float
77 (char) @constant.character
88 [
99 (string)
1010 (triple_quote_string)
1111 ] @string
1212
13− (con_unit) @constant.builtin ; unit, as in ()
14−
1513 (comment) @comment
1614
1715
@@ -36,6 +34,10 @@
3634; ----------------------------------------------------------------------------
3735; Keywords, operators, includes
3836
37+ ; This needs to come before the other "else" in
38+ ; order to be highlighted correctly
39+ (class_instance "else" @keyword)
40+
3941 [
4042 "if"
4143 "then"
@@ -53,15 +55,20 @@
5355 (operator)
5456 (constructor_operator)
5557 (type_operator)
56− (tycon_arrow)
5758 (qualified_module) ; grabs the `.` (dot), ex: import System.IO
5859 (all_names)
60+
61+ ; `_` wildcards in if-then-else and case-of expressions,
62+ ; as well as record updates and operator sections
63+ (wildcard)
5964 "="
6065 "|"
6166 "::"
6267 "∷"
6368 "=>"
6469 "⇒"
70+ "<="
71+ "⇐"
6572 "->"
6673 "→"
6774 "<-"
@@ -89,6 +96,7 @@
8996 "newtype"
9097 "type"
9198 "as"
99+ "hiding"
92100 "do"
93101 "ado"
94102 "forall"
@@ -98,24 +106,40 @@
98106 "infixr"
99107 ] @keyword
100108
109+ (type_role_declaration
110+ "role" @keyword
111+ role: (type_role) @keyword)
112+
113+ (hole) @label
101114
102115; ----------------------------------------------------------------------------
103116; Functions and variables
104117
118+ (row_field (field_name) @variable.other.member)
119+ (record_field (field_name) @variable.other.member)
120+ (record_accessor (variable) @variable.other.member)
121+ (exp_record_access (variable) @variable.other.member)
122+
105123 (signature name: (variable) @type)
106124 (function name: (variable) @function)
125+ (class_instance (instance_name) @function)
126+ (derive_declaration (instance_name) @function)
107127
108128 ; true or false
109129((variable) @constant.builtin.boolean
110130 (#match? @constant.builtin.boolean "^(true|false)$"))
111131
112− (variable) @variable
132+ ; The former one works for `tree-sitter highlight` but not in Helix/Kakoune.
133+ ; The latter two work in Helix (but not Kakoune) and are a good compromise between not highlighting anything at all
134+ ; as an operator and leaving it to the child nodes, and highlighting everything as an operator.
135+ (exp_ticked (_) @operator)
136+ (exp_ticked (exp_name (variable) @operator))
137+ (exp_ticked (exp_name (qualified_variable (variable) @operator)))
113138
114− (exp_infix (variable) @operator) ; consider infix functions as operators
139+ (variable) @variable
115140
116141 ("@" @namespace) ; "as" pattern operator, e.g. x@Constructor
117142
118−
119143; ----------------------------------------------------------------------------
120144; Types
121145