@@ -41,7 +41,7 @@
4141 <indentation>
4242 <increase>
4343 <expression>
44− (case|class|do|let|where).*
44+ (case|class|do|let|where|=).*
4545 </expression>
4646 </increase>
4747 <decrease>
@@ -57,8 +57,6 @@
5757 <include syntax="self" collection="type-family-definition" />
5858 <include syntax="self" collection="pattern-definition" />
5959 <include syntax="self" collection="type-definition" />
60− <!-- <include syntax="self" collection="type-annotation" /> -->
61− <include syntax="self" collection="data-definition" />
6260 <include syntax="self" collection="GADT-definition" />
6361 <include syntax="self" collection="instance" />
6462 <include syntax="self" collection="typeclass" />
@@ -67,7 +65,6 @@
6765
6866 <template-scopes>
6967 <include syntax="self" collection="Quote" />
70− <include syntax="self" collection="comments" />
7168 </template-scopes>
7269
7370 <collections>
@@ -80,52 +77,27 @@
8077 </collection>
8178
8279 <collection name="expressions">
83− <include syntax="self" collection="do-bind" />
80+ <scope name="haskell.construct.keyword.at">
81+ <expression>@</expression>
82+ </scope>
83+ <scope name="haskell.construct.keyword.case-arrow">
84+ <expression>-></expression>
85+ </scope>
86+ <scope name="haskell.construct.keyword.bind-arrow">
87+ <expression><-</expression>
88+ </scope>
89+ <include syntax="self" collection="keywords" />
8490 <include syntax="self" collection="literal" />
8591 <include syntax="self" collection="operators" />
92+ <include syntax="self" collection="record-match" />
8693 <include syntax="self" collection="list" />
94+ <include syntax="self" collection="view-pattern" />
8795 <include syntax="self" collection="lambda-case" />
8896 <include syntax="self" collection="lambda-head" />
89− <include syntax="self" collection="type-applications" />
90− <include syntax="self" collection="outer-case-expression" />
97+ <include syntax="self" collection="case-expression" />
98+ <include syntax="self" collection="qconid" />
9199 <include syntax="self" collection="qvarid" />
92100 <include syntax="self" collection="tuple" />
93−
94−
95−
96− <!-- Needed for do binds -->
97− <!-- <include syntax="self" collection="pattern-match" /> -->
98− </collection>
99−
100− <collection name="pattern-match">
101− <include syntax="self" collection="literal" />
102− <include syntax="self" collection="tuple-match" />
103− <!-- <include syntax="self" collection="at-pattern" /> -->
104− <include syntax="self" collection="varid" />
105− <include syntax="self" collection="qconid" />
106− <include syntax="self" collection="record-match" />
107− <include syntax="self" collection="list-pattern" />
108− <include syntax="self" collection="view-pattern" />
109− </collection>
110−
111− <collection name="type-applications">
112− <scope name="type-applications">
113− <starts-with>
114− <expression>(\s@)\(</expression>
115− <capture number="1" name="haskell.keyword.operator.typeapplication" />
116− </starts-with>
117− <ends-with>
118− <expression>)</expression>
119− </ends-with>
120− <subscopes>
121− <include syntax="self" collection="type" />
122− </subscopes>
123− </scope>
124− <scope name="type-applications-single">
125− <expression>(@)(\w+)</expression>
126− <capture number="1" name="haskell.keyword.operator.typeapplication" />
127− <capture number="2" name="haskell.identifier.type" />
128− </scope>
129101 </collection>
130102
131103 <collection name="Quote">
@@ -164,8 +136,8 @@
164136 <capture number="1" name="haskell.pattern.record.bracket" />
165137 </ends-with>
166138 <subscopes>
167− <include syntax="self" collection="pattern-match" />
168− <include syntax="self" collection="varid" />
139+ <include syntax="self" collection="comments" />
140+ <include syntax="self" collection="expressions" />
169141 <scope name="record-sep">
170142 <expression>=</expression>
171143 </scope>
@@ -187,6 +159,7 @@
187159 <capture number="1" name="haskell.pattern.record.bracket" />
188160 </ends-with>
189161 <subscopes>
162+ <include syntax="self" collection="comments" />
190163 <scope name="haskell.pattern.record.wildcard">
191164 <expression>\.\.</expression>
192165 </scope>
@@ -213,29 +186,12 @@
213186 <capture number="1" name="haskell.list.bracket" />
214187 </ends-with>
215188 <subscopes>
189+ <include syntax="self" collection="comments" />
216190 <include syntax="self" collection="expressions" />
217191 </subscopes>
218192 </scope>
219193 </collection>
220194
221− <collection name="list-pattern">
222− <symbol type="expression" />
223− <scope name="haskell.pattern.list">
224− <starts-with>
225− <expression>(\[)</expression>
226− <capture number="1" name="haskell.pattern.list.bracket" />
227− </starts-with>
228− <ends-with>
229− <expression>(\])</expression>
230− <capture number="1" name="haskell.pattern.list.bracket" />
231− </ends-with>
232− <subscopes>
233− <include syntax="self" collection="pattern-match" />
234− </subscopes>
235− </scope>
236− </collection>
237−
238−
239195 <collection name="view-pattern">
240196 <scope name="haskell.pattern.view">
241197 <symbol type="expression" />
@@ -252,24 +208,7 @@
252208 <scope name="haskell.pattern.view.operator.arrow">
253209 <expression>-></expression>
254210 </scope>
255− <include syntax="self" collection="pattern-match" />
256− </subscopes>
257− </scope>
258− </collection>
259−
260− <collection name="tuple-match">
261− <symbol type="expression" />
262− <scope name="haskell.pattern.tuple">
263− <starts-with>
264− <expression>(\()</expression>
265− <capture number="1" name="haskell.pattern.tuple.bracket" />
266− </starts-with>
267− <ends-with>
268− <expression>(\))</expression>
269− <capture number="1" name="haskell.pattern.tuple.bracket" />
270− </ends-with>
271− <subscopes>
272− <include syntax="self" collection="pattern-match" />
211+ <include syntax="self" collection="expressions" />
273212 </subscopes>
274213 </scope>
275214 </collection>
@@ -285,49 +224,7 @@
285224 <capture number="1" name="haskell.case.keyword.condition" />
286225 </ends-with>
287226 <subscopes anchored="true">
288− <include syntax="self" collection="pattern-match" />
289− </subscopes>
290− </scope>
291− </collection>
292−
293− <collection name="case-match">
294− <scope name="case-match">
295− <starts-with>
296− <expression>(?=((\h*)\S.*->($|\h)))</expression>
297− </starts-with>
298− <ends-with>
299− <expression>-></expression>
300− </ends-with>
301− <subscopes anchored="true">
302− <include syntax="self" collection="pattern-match" />
303− </subscopes>
304− </scope>
305− </collection>
306−
307− <collection name="inner-case-expressions">
308− <scope name="inner-case-expressions">
309− <starts-with>
310− <expression>(?=((\h*)\S.*->($|\h)))</expression>
311− </starts-with>
312− <ends-with>
313− <template>^(?!\1)(?!\2\h)(?!\s*$)</template>
314− </ends-with>
315− <subscopes>
316− <include syntax="self" collection="case-match" />
317− <include syntax="self" collection="expressions"/>
318− </subscopes>
319− </scope>
320− </collection>
321−
322− <collection name="outer-case-expression">
323− <scope name="outer-case-expression">
324− <starts-with>
325− <expression>(?=case)</expression>
326− </starts-with>
327− <ends-with />
328− <subscopes anchored="true" skip-whitespace="false">
329− <include syntax="self" collection="case-expression" />
330− <include syntax="self" collection="inner-case-expressions" repeat="true" />
227+ <include syntax="self" collection="expressions" />
331228 </subscopes>
332229 </scope>
333230 </collection>
@@ -344,136 +241,144 @@
344241 <capture number="1" name="haskell.tuple.bracket" />
345242 </ends-with>
346243 <subscopes>
244+ <include syntax="self" collection="comments" />
347245 <include syntax="self" collection="expressions" />
348246 </subscopes>
349247 </scope>
350248 </collection>
351249
352250 <collection name="typeclass">
353− <symbol type="interface" />
354− <scope name="haskell.definition.class">
251+ <scope name="haskell.definition.class.head">
252+ <symbol type="class" scope="global" name-selector="haskell.keyword.construct.class.name">
253+ <context behavior="whitespace" foldable="true" />
254+ </symbol>
355255 <starts-with>
356256 <expression>^(\h*)(class)($|\h)</expression>
357257 <capture number="2" name="haskell.keyword.construct.class" />
358258 </starts-with>
359− <ends-with>
360− <template>^(?!\s+\1\S)(?!\s*$)</template>
361− </ends-with>
362− <subscopes>
363− <scope name="haskell.keyword.construct.where">
259+ <ends-with />
260+ <subscopes anchored="true">
261+ <scope name="haskell.keyword.construct.class.name">
262+ <starts-with>
263+ <expression></expression>
264+ </starts-with>
265+ <ends-with>
266+ <expression>(?=(where|^\s*$))</expression>
267+ </ends-with>
268+ <subscopes>
269+ <include syntax="self" collection="comments" />
270+ <include syntax="self" collection="type" />
271+ </subscopes>
272+ </scope>
273+ <scope name="haskell.keyword.construct.where" optional="true">
364274 <expression>where</expression>
365275 </scope>
366− <include syntax="self" collection="type" />
367− <include syntax="self" collection="type-definition" />
368− <!-- <include syntax="self" collection="type-annotation" /> -->
369− <include syntax="self" collection="definition" />
370276 </subscopes>
371277 </scope>
372278 </collection>
373279
374280 <collection name="instance">
375281 <scope name="haskell.instance">
376− <symbol type="category" />
282+ <symbol type="category" name-selector="haskell.keyword.construct.instance.name">
283+ <context behavior="whitespace" foldable="true" />
284+ </symbol>
377285 <starts-with>
378286 <expression>^(\h*)(instance)($|\h)</expression>
379287 <capture number="2" name="haskell.keyword.construct.instance" />
380288 </starts-with>
381− <ends-with>
382− <template>^(?!\s+\1\S)(?!\s*$)</template>
383− </ends-with>
384− <subscopes>
385− <scope name="haskell.keyword.construct.where">
289+ <ends-with />
290+ <subscopes anchored="true">
291+ <scope name="haskell.keyword.construct.instance.name">
292+ <starts-with>
293+ <expression></expression>
294+ </starts-with>
295+ <ends-with>
296+ <expression>(?=(where|^\s*$))</expression>
297+ </ends-with>
298+ <subscopes>
299+ <include syntax="self" collection="type" />
300+ </subscopes>
301+ </scope>
302+ <scope name="haskell.keyword.construct.where" optional="true">
386303 <expression>where</expression>
387304 </scope>
388− <include syntax="self" collection="type" />
389− <include syntax="self" collection="type-definition" />
390− <include syntax="self" collection="type-annotation" />
391− <include syntax="self" collection="definition" />
392305 </subscopes>
393306 </scope>
394307 </collection>
395308
396309 <collection name="type-family-definition">
397− <scope name="haskell.definition.type.type-family">
398− <symbol type="type" />
310+ <scope name="haskell.definition.type-family.type">
399311 <starts-with>
400− <expression>^(\h*)(type\h+family)\h+`?(\w(\w|')*)`?($|\h)</expression>
312+ <expression>^(\h*)(type\h+family)</expression>
401313 <capture number="2" name="haskell.keyword.construct.type-family" />
402314 </starts-with>
403315 <ends-with>
404316 <template>^(?!\s+\1\S)(?!\s*$)</template>
405317 </ends-with>
406− <subscopes>
407− <scope name="haskell.keyword.construct.where">
408− <expression>where</expression>
318+ <subscopes anchored="true" skip-whitespace="false">
319+ <scope name="haskell.type-family.head">
320+ <starts-with>
321+ <expression></expression>
322+ </starts-with>
323+ <ends-with>
324+ <expression>where</expression>
325+ <capture number="0" name="haskell.keyword.construct.where" />
326+ </ends-with>
327+ <subscopes anchored="true">
328+ <scope name="haskell.identifier.type-family.type.name">
329+ <expression>\S+</expression>
330+ </scope>
331+ <include syntax="self" collection="type" repeat="true" optional="true" />
332+ </subscopes>
409333 </scope>
410− <include syntax="self" collection="type" />
411− </subscopes>
412− </scope>
413− </collection>
414334
415− <collection name="definition">
416− <scope name="haskell.definition.type.function">
417− <symbol type="function">
418− <display-name>
419− <component selector="haskell.definition.type.function" />
420− </display-name>
421−
422− </symbol>
423− <starts-with>
424− <expression>^(?=(\h*)(default\h+)?`?(\w(\w|')*)`?($|\h))</expression>
425− <capture number="2" name="haskell.keyword.construct.default" />
426− <capture number="3" name="haskell.identifier.function" />
427− </starts-with>
428− <ends-with>
429− <template>^(?!\1\3\s)(?!\s+\1\S)(?!\s*$)</template>
430− </ends-with>
431− <subscopes>
432− <include syntax="self" collection="type-annotation" />
433− <include syntax="self" collection="implementation" />
335+ <include syntax="self" collection="type-family-case-definition" optional="true" repeat="true" />
434336 </subscopes>
435337 </scope>
436338 </collection>
437339
438− <collection name="do-bind">
439− <scope name="do-bind">
340+ <collection name="type-family-case-definition">
341+ <scope name="haskell.definition.type-family.type.case">
440342 <starts-with>
441− <expression>^(?=((\h*)\S.+<-($|\h)))</expression>
343+ <expression>^(\h*)(?=\S)</expression>
442344 </starts-with>
443345 <ends-with>
444− <template>^(?!\1)(?!\2\h)(?!\s*$)</template>
346+ <template>^(?!\s+\1\S)(?!\s*$)</template>
445347 </ends-with>
446348 <subscopes>
447− <include syntax="self" collection="do-pattern" />
448− <include syntax="self" collection="expressions" />
449− <!-- <scope name="bind-arrow">
450− <expression><-</expression>
451− </scope> -->
349+ <include syntax="self" collection="comments" />
350+ <include syntax="self" collection="type" optional="true" repeat="true" />
351+ <scope>
352+ <expression>=</expression>
353+ </scope>
354+ <include syntax="self" collection="type" optional="true" repeat="true" />
452355 </subscopes>
453356 </scope>
454357 </collection>
455358
456− <collection name="do-pattern">
457− <scope name="do-pattern">
359+ <collection name="definition">
360+ <scope name="haskell.definition.type.function">
361+ <symbol type="function">
362+ <context behavior="whitespace" foldable="true" />
363+ </symbol>
458364 <starts-with>
459− <expression>^(?=((\h*)\S.+<-($|\h)))</expression>
365+ <expression>^(?=(\h*)(default\h+)?`?(\w(\w|')*)`?($|\h))</expression>
366+ <capture number="2" name="haskell.keyword.construct.default" />
367+ <capture number="3" name="haskell.identifier.function.name" />
460368 </starts-with>
461369 <ends-with>
462− <expression><-</expression>
370+ <template>^(?!\1\3\s)(?!\s+\1\S)(?!\s*$)</template>
463371 </ends-with>
464372 <subscopes>
465− <include syntax="self" collection="pattern-match" />
466− <!-- <scope name="bind-arrow">
467− <expression><-</expression>
468− </scope>
469− <include syntax="self" collection="expressions" repeat="true" /> -->
373+ <include syntax="self" collection="comments" />
374+ <include syntax="self" collection="type-annotation" />
375+ <include syntax="self" collection="implementation" />
470376 </subscopes>
471377 </scope>
472378 </collection>
473379
474380 <collection name="implementation">
475− <scope name="haskell.definition.type.function">
476− <local scope="within-construct" />
381+ <scope name="haskell.definition.type.function.implementation">
477382 <starts-with>
478383 <expression>^(\h*)(default\h+)?`?(\w(\w|')*)`?($|\h)</expression>
479384 <capture number="2" name="haskell.keyword.construct.default" />
@@ -483,14 +388,20 @@
483388 <template>^(?!\1\3\s)(?!\s+\1\S)(?!\s*$)</template>
484389 </ends-with>
485390 <subscopes>
486− <include syntax="self" collection="where-clause" />
487− <include syntax="self" collection="expressions" />
391+ <include syntax="self" collection="comments" />
392+ <include syntax="self" collection="pattern-match" optional="true" repeat="true" />
393+ <scope>
394+ <expression>=</expression>
395+ <capture number="0" name="haskell.construct.function.keyword.eq" />
396+ </scope>
397+ <include syntax="self" collection="expressions" optional="true" repeat="true" />
398+ <include syntax="self" collection="where-clause" optional="true" />
488399 </subscopes>
489400 </scope>
490401 </collection>
491402
492403 <collection name="type-annotation">
493− <scope name="haskell.definition.type.function">
404+ <scope name="haskell.definition.type.function.type-signature">
494405 <starts-with>
495406 <expression>^(\h*)`?(\w(\w|')*)`?\h*::($|\h)</expression>
496407 <capture number="2" name="haskell.identifier.function" />
@@ -499,6 +410,7 @@
499410 <template>^(?!\s+\1\S)(?!\s*$)</template>
500411 </ends-with>
501412 <subscopes>
413+ <include syntax="self" collection="comments" />
502414 <include syntax="self" collection="type" />
503415 </subscopes>
504416 </scope>
@@ -506,15 +418,19 @@
506418
507419 <collection name="type-definition">
508420 <scope name="haskell.definition.type">
421+ <symbol type="type" scope="global">
422+ <context behavior="whitespace" foldable="true" />
423+ </symbol>
509424 <starts-with>
510425 <expression>^(\h*)(type)\h+(\w(\w|')*)</expression>
511426 <capture number="2" name="haskell.keyword.construct.type" />
512− <capture number="3" name="haskell.identifier.type" />
427+ <capture number="3" name="haskell.identifier.type.name" />
513428 </starts-with>
514429 <ends-with>
515430 <template>^(?!\s+\1\S)(?!\s*$)</template>
516431 </ends-with>
517432 <subscopes>
433+ <include syntax="self" collection="comments" />
518434 <include syntax="self" collection="type" />
519435 </subscopes>
520436 </scope>
@@ -522,66 +438,72 @@
522438
523439 <collection name="GADT-definition">
524440 <scope name="haskell.definition.struct.GADT">
441+ <symbol type="struct" scope="global">
442+ <context behavior="subtree" foldable="false" />
443+ </symbol>
525444 <starts-with>
526− <expression>^(\h*)(data)\h+(\w(\w|')*)</expression>
445+ <expression>^(\h*)(data|newtype)\h+(\w(\w|')*)</expression>
527446 <capture number="2" name="haskell.keyword.construct.data.GADT" />
447+ <capture number="3" name="haskell.identifier.data.type.name" />
528448 </starts-with>
529449 <ends-with>
530450 <template>^(?!\s+\1\S)(?!\s*$)</template>
531451 </ends-with>
532452 <subscopes>
453+ <include syntax="self" collection="comments" />
454+ <scope name="haskell.keyword.construct.where">
455+ <expression>where</expression>
456+ </scope>
457+
458+ <include syntax="self" collection="deriving-clause" />
459+ <include syntax="self" collection="record-definition" />
533460 <include syntax="self" collection="gadt-constructor" />
534461 <include syntax="self" collection="type" />
535− <include syntax="self" collection="record-definition" />
536− <include syntax="self" collection="record-definition-field-name" />
537462 </subscopes>
538463 </scope>
539464 </collection>
540465
541466 <collection name="gadt-constructor">
542− <scope name="identifier.type.struct.GADT.constructor">
543− <expression>^\h+[A-Z](\w|')*</expression>
544− </scope>
545− </collection>
546−
547− <collection name="data-definition">
548− <scope name="haskell.definition.struct.data">
467+ <scope name="haskell.identifier.type.struct.data.constructor">
468+ <symbol type="constructor">
469+ <context behavior="subtree" foldable="true" />
470+ </symbol>
549471 <starts-with>
550− <expression>^(\h*)(data|newtype)\h+(\w(\w|')*)</expression>
551− <capture number="2" name="haskell.keyword.construct.data.newtype" />
552− <capture number="3" name="haskell.identifier.type" />
472+ <expression>(^|=|\||^)\h+([A-Z](\w|')*)</expression>
473+ <capture number="2" name="haskell.identifier.data.name" />
553474 </starts-with>
554− <ends-with>
555− <template>^(?!\s+\1\S)(?!\s*$)</template>
556− </ends-with>
557− <subscopes>
475+ <ends-with />
476+ <subscopes anchored="true">
558477 <include syntax="self" collection="record-definition" />
559− <include syntax="self" collection="data-constructor" />
560− <include syntax="self" collection="type" />
561478 </subscopes>
562479 </scope>
563480 </collection>
564481
565− <collection name="data-constructor">
566− <scope name="haskell.identifier.type.struct.data.constructor">
567− <expression>=\h+[A-Z](\w|')*</expression>
482+ <collection name="deriving-clause">
483+ <scope name="haskell.record.construct.deriving.keyword">
484+ <expression>deriving(\h+(newtype|stock|anyclass))?</expression>
568485 </scope>
569− <scope name="haskell.identifier.type.struct.data.constructor">
570− <expression>\|\h+[A-Z](\w|')*</expression>
486+ <scope name="haskell.record.construct.deriving.keyword">
487+ <include syntax="self" collection="comments" />
488+ <expression>via</expression>
571489 </scope>
572490 </collection>
573491
574492 <collection name="record-definition">
575493 <scope name="haskell.record">
494+ <symbol>
495+ <context behavior="subtree" foldable="true" />
496+ </symbol>
576497 <starts-with>
577− <expression>(\{)</expression>
578− <capture number="1" name="haskell.record.bracket" />
498+ <expression>(?=\{)</expression>
499+ <capture number="0" name="haskell.record.bracket" />
579500 </starts-with>
580501 <ends-with>
581502 <expression>(\})</expression>
582503 <capture number="1" name="haskell.record.bracket" />
583504 </ends-with>
584505 <subscopes>
506+ <include syntax="self" collection="comments" />
585507 <include syntax="self" collection="record-definition-field-name" />
586508 <include syntax="self" collection="type" />
587509 </subscopes>
@@ -590,26 +512,65 @@
590512
591513 <collection name="record-definition-field-name">
592514 <scope name="haskell.record.definition.property">
593− <expression>\w(\w|')*\h*::</expression>
515+ <symbol type="property" />
516+ <expression>(((?![A-Z])\w(\w|')*)\h*::|(^|\{|,)\h*((?![A-Z])\w(\w|')*))</expression>
517+ <capture number="5" name="haskell.record.definition.property.field.property.name" />
518+ <capture number="2" name="haskell.record.definition.property.field.property.name" />
594519 </scope>
595520 </collection>
596521
597522 <collection name="type">
523+ <scope name="haskell.keyword.construct.function-arrow">
524+ <expression>-></expression>
525+ </scope>
526+ <scope name="haskell.keyword.construct.fat-arrow">
527+ <expression>=></expression>
528+ </scope>
529+ <include syntax="self" collection="strings" />
530+ <scope name="haskell.type.construct.tuple">
531+ <starts-with>
532+ <expression>\(</expression>
533+ </starts-with>
534+ <ends-with>
535+ <expression>\)</expression>
536+ </ends-with>
537+ <subscopes>
538+ <include syntax="self" collection="comments" />
539+ <scope name="haskell.construct.type.typle.comma">
540+ <expression>\,</expression>
541+ </scope>
542+ <include syntax="self" collection="type" />
543+ </subscopes>
544+ </scope>
545+ <scope name="haskell.type.list">
546+ <starts-with>
547+ <expression>'?\[</expression>
548+ </starts-with>
549+ <ends-with>
550+ <expression>\]</expression>
551+ </ends-with>
552+ <subscopes>
553+ <include syntax="self" collection="comments" />
554+ <include syntax="self" collection="type" />
555+ </subscopes>
556+ </scope>
557+ <scope name="haskell.type.star">
558+ <expression>\*</expression>
559+ </scope>
560+ <scope name="haskell.keyword.construct.type-annotation-operator">
561+ <expression>::</expression>
562+ </scope>
598563 <include syntax="self" collection="type-list" />
599− <scope name="haskell.identifier.type">
600− <expression>([A-Z](\w|')*\.)*[A-Z](\w|')*</expression>
564+ <scope>
565+ <expression>(([A-Z](\w|')*\.)*)'*\!?([A-Z](\w|')*)</expression>
566+ <capture number="1" name="haskell.identifier.package.module" />
567+ <capture number="4" name="haskell.identifier.type" />
601568 </scope>
602569 <scope name="haskell.keyword.construct.forall">
603570 <expression>forall</expression>
604571 </scope>
605572 <scope name="haskell.identifier.type.variable">
606− <expression>\w(\w|')*</expression>
607− </scope>
608− <scope name="haskell.keyword.construct.function-arrow">
609− <expression>-></expression>
610− </scope>
611− <scope name="haskell.keyword.construct.fat-arrow">
612− <expression>=></expression>
573+ <expression>(?!where)(?!=)((?!(\(|\)|\,|\!))\S)((?!(\(|\)|\,))\w)*</expression>
613574 </scope>
614575 </collection>
615576
@@ -624,6 +585,7 @@
624585 <template>^(?!\s+\1\S)(?!\s*$)</template>
625586 </ends-with>
626587 <subscopes>
588+ <include syntax="self" collection="comments" />
627589 <scope name="haskell.keyword.construct.where">
628590 <expression>where</expression>
629591 </scope>
@@ -643,6 +605,7 @@
643605 <capture number="1" name="haskell.type-list.bracket" />
644606 </ends-with>
645607 <subscopes>
608+ <include syntax="self" collection="comments" />
646609 <include syntax="self" collection="type" />
647610 </subscopes>
648611 </scope>
@@ -659,6 +622,7 @@
659622 <capture number="1" name="haskell.keyword.construct.lambda" />
660623 </ends-with>
661624 <subscopes>
625+ <include syntax="self" collection="comments" />
662626 <include syntax="self" collection="pattern-match" />
663627 </subscopes>
664628 </scope>
@@ -672,7 +636,6 @@
672636
673637 <collection name="where-clause">
674638 <scope name="haskell.construct.where">
675− <local scope="within-parent" />
676639 <starts-with>
677640 <expression>^(\h*)(where)</expression>
678641 <capture number="2" name="haskell.construct.keyword.where" />
@@ -681,6 +644,7 @@
681644 <template>^(?!\1\s*\S)(?!s*$)</template>
682645 </ends-with>
683646 <subscopes>
647+ <include syntax="self" collection="comments" />
684648 <include syntax="self" collection="definition" />
685649 </subscopes>
686650 </scope>
@@ -689,7 +653,9 @@
689653
690654 <collection name="qvarid">
691655 <scope name="haskell.identifier.function">
692− <expression>([A-Z](\w|')*\.)*\w(\w|')*</expression>
656+ <expression>(([A-Z](\w|')*\.)*)(\w(\w|')*)</expression>
657+ <capture number="1" name="haskell.identifier.package.module" />
658+ <capture number="4" name="haskell.identifier.type" />
693659 </scope>
694660 </collection>
695661
@@ -718,12 +684,12 @@
718684
719685
720686 <collection name="strings">
721− <scope name="haskell.string.double-quoted">
687+ <scope name="haskell.string.double-quoted" spell-check="true">
722688 <starts-with>
723− <expression>"</expression>
689+ <expression>"</expression>
724690 </starts-with>
725691 <ends-with>
726− <expression>"</expression>
692+ <expression>"</expression>
727693 </ends-with>
728694 <subscopes>
729695 <scope name="haskell.string.escape-sequences">
@@ -746,8 +712,11 @@
746712
747713 <collection name="module">
748714 <scope name="haskell.definition.module.package">
715+ <symbol type="package">
716+ <context behavior="subtree" foldable="true" export-local="true" />
717+ </symbol>
749718 <starts-with>
750− <expression>^(module)\s+(\w|\.)+</expression>
719+ <expression>^(module)\s+((\w|\.)+)</expression>
751720 <capture number="1" name="haskell.construct.keyword.module" />
752721 <capture number="2" name="haskell.definition.module.package" />
753722 </starts-with>
@@ -755,32 +724,75 @@
755724 <expression>(where)</expression>
756725 <capture number="1" name="haskell.construct.keyword.module" />
757726 </ends-with>
758− <subscopes export-symbols="true">
759− <scope name="identifier.constant">
727+ <subscopes>
728+ <scope name="identifier.haskell.type">
729+ <symbol type="expression" />
730+ <symbol type="expression" />
731+ <expression>([A-Z](\w|')*)\h*(\(\h*\.\.\h*\))?</expression>
732+ <capture number="1" name="identifier.type" />
733+ </scope>
734+ <scope name="identifier.variable">
735+ <symbol type="expression" />
760736 <expression>(\w|')+</expression>
737+ <capture number="0" name="identifier.haskell.function" />
761738 </scope>
762739 </subscopes>
763740 </scope>
764741 </collection>
765742
766743 <collection name="import">
767− <scope name="haskell.construct.keyword.import">
768− <expression>^import\s</expression>
769− </scope>
770− <scope name="haskell.construct.keyword.qualified">
771− <expression>qualified</expression>
772− </scope>
773− <scope name="haskell.construct.keyword.as">
774− <expression>as</expression>
775− </scope>
776− <scope name="haskell.identifier.module.package">
777− <expression>([A-Z](\w|')*\.)*[A-Z](\w|')*</expression>
744+ <scope name="haskell.construct.import">
745+ <starts-with>
746+ <expression>^(import)\s</expression>
747+ <capture number="1" name="haskell.construct.keyword.import" />
748+ </starts-with>
749+ <ends-with>
750+ <expression>(?=^\S)</expression>
751+ </ends-with>
752+ <subscopes>
753+ <scope name="haskell.construct.qualified">
754+ <symbol type="expression" />
755+ <expression>qualified</expression>
756+ <capture number="0" name="haskell.construct.keyword.qualified" />
757+ </scope>
758+
759+ <scope name="haskell.construct.hiding">
760+ <symbol type="keyword">
761+ <context behavior="subtree" />
762+ </symbol>
763+ <starts-with>
764+ <expression>(hiding)\h*(?=\()</expression>
765+ <capture number="1" name="haskell.construct.keyword.hiding" />
766+ </starts-with>
767+ <ends-with>
768+ <expression>(?=\))</expression>
769+ </ends-with>
770+ <subscopes anchored="true">
771+ <include syntax="self" collection="import-list" />
772+ <symbol type="expression" />
773+ </subscopes>
774+ </scope>
775+
776+ <scope name="haskell.construct.keyword.as">
777+ <symbol type="package" />
778+ <expression>as(\h+([A-Z]\w*))?</expression>
779+ <capture number="2" name="haskell.package.qualified.name" />
780+ </scope>
781+ <scope name="haskell.identifier.module.package">
782+ <symbol type="package" />
783+ <expression>([A-Z](\w|')*\.)*[A-Z](\w|')*</expression>
784+ <capture number="0" name="haskell.package.name" />
785+ </scope>
786+ <include syntax="self" collection="import-list" />
787+ </subscopes>
778788 </scope>
779− <include syntax="self" collection="import-list" />
780789 </collection>
781790
782791 <collection name="import-list">
783792 <scope name="import-list">
793+ <symbol>
794+ <context behavior="subtree" export-local="true" />
795+ </symbol>
784796 <starts-with>
785797 <expression>(\()</expression>
786798 <capture number="1" name="haskell.import-list.bracket" />
@@ -790,20 +802,21 @@
790802 <capture number="1" name="haskell.import-list.bracket" />
791803 </ends-with>
792804 <subscopes>
793− <scope name="identifier.decorator">
794− <expression>([A-Z](\w|')*\.)*\w(\w|')*</expression>
805+ <scope name="haskell.identifier.struct">
806+ <symbol type="expression" />
807+ <symbol type="reference" scope="local" />
808+ <expression>([A-Z](\w|')*)\h*(\(\h*\.\.\h*\))?</expression>
809+ <capture number="1" name="haskell.import-list.identifier.type.name" />
810+ </scope>
811+ <scope name="haskell.identifier.function">
812+ <symbol type="reference" scope="local" />
813+ <expression>(\w|')+</expression>
814+ <capture number="0" name="haskell.import-list.function.name" />
795815 </scope>
796816 </subscopes>
797817 </scope>
798818 </collection>
799819
800− <!-- <collection name="special">
801− <scope>
802− <expression>(;|,)</expression>
803− </scope>
804− </collection> -->
805−
806−
807820 <collection name="reservedop">
808821 <scope name="keyword.operator">
809822 <expression>(\.\.|:|::|=|\\|\||<-|->|@|~|=>)</expression>
@@ -811,10 +824,11 @@
811824 </collection>
812825
813826 <collection name="keywords">
814− <scope name="haskell.keyword.modifier">
827+ <scope name="haskell.keyword.self">
815828 <symbol type="keyword" />
816829 <strings>
817830 <string>do</string>
831+ <string>mdo</string>
818832 <string>in</string>
819833 <string>infix</string>
820834 <string>infixl</string>
@@ -852,20 +866,18 @@
852866 <strings>
853867 <string>undefined</string>
854868 <string>_</string>
869+ <string>@</string>
855870 </strings>
856871 </scope>
857872 </collection>
858873
859874 <collection name="comments">
860875 <scope name="haskell.comment.single" spell-check="true">
861− <starts-with>
862− <expression>--</expression>
863− </starts-with>
864− <ends-with>
865− <expression>$</expression>
866− </ends-with>
876+ <symbol type="comment" />
877+ <expression> --.*$</expression>
867878 </scope>
868879 <scope name="haskell.comment.block" spell-check="true">
880+ <symbol type="comment" />
869881 <starts-with>
870882 <expression>{-</expression>
871883 </starts-with>