cursorless
cursorless copied to clipboard
Adds support for the Haskell programming language
Adds support for the Haskell programming language.
Roadmap
- [ ]
argumentOrParameter:- [x]
argument.actual - [ ]
argument.actual.iterationBlocked on one of:- #557
- #2177
- [x]
argument.formal - [x]
argument.formal.iteration
- [x]
- [x]
anonymousFunction - [ ]
branch- [x]
branch.match - [x]
branch.match.iteration - [ ]
branch.if - [ ]
branch.if.iteration - [ ]
branch.guard - [ ]
branch.guard.iteration - [ ]
branch.ternary
- [x]
- [ ]
collectionItem - [ ]
collectionKey- [ ]
key.mapPair - [ ]
key.mapPair.iteration
- [ ]
- [ ]
comment- [ ]
comment.line - [ ]
comment.block
- [ ]
- [ ]
functionCall- [x]
functionCall - [ ]
functionCall.constructor
- [x]
- [ ]
functionCallee- [x]
functionCallee - [ ]
functionCallee.constructor
- [x]
- [x]
functionName - [ ]
ifStatement - [x]
list - [ ]
map - [ ]
name- [ ]
name.assignment - [ ]
name.assignment.pattern - [x]
name.function - [ ]
name.class - [ ]
name.field
- [ ]
- [ ]
namedFunction- [x]
namedFunction - [ ]
namedFunction.method
- [x]
- [ ]
statement- [ ]
statement - [ ]
statement.iteration.document - [ ]
statement.iteration.block
- [ ]
- [x]
string - [ ]
type- [ ]
class - [ ]
class.instance - [ ]
className - [ ]
type.adt - [ ]
type.alias - [ ]
type.annotation - [ ]
type.constraint - [ ]
type.dataFamily - [ ]
type.dataInstance - [ ]
type.field - [ ]
type.foreignExport - [ ]
type.foreignImport - [ ]
type.function - [ ]
type.gadt - [ ]
type.newtype - [ ]
type.typeFamily - [ ]
type.typeInstance
- [ ]
- [ ]
value- [ ]
value.assignment - [ ]
value.field - [ ]
value.mapPair - [ ]
value.mapPair.iteration - [ ]
value.return
- [ ]
- [ ]
condition- [ ]
condition.if - [ ]
condition.ternary - [ ]
condition.match
- [ ]
Warning
This is work in progress. In the early stages, I'll be messy.
- The commits will be uninformative.
- The branch may receive force pushes at any point!
Discussion and RFCs
See #2186.
Haskell Node Types
adtall_namesaltaltsannotated_type_variablebind_patterncalling_conventioncharclassclass_bodyclass_headclass_namecommacommentcon_listcon_tuplecon_unitconstraintconstructorconstructor_operatorconstructorscontextcppdata_constructordata_constructor_infixdata_constructor_recorddata_familydata_instancedecl_tyfam_sigdecl_typedeclsdefault_declarationdefault_signaturederivingderiving_declarationderiving_strategydo_moduleempty_fileequationexp_applyexp_arithmetic_sequenceexp_caseexp_condexp_doexp_fieldexp_if_guardexp_inexp_infixexp_lambdaexp_lambda_caseexp_letexp_let_inexp_listexp_list_comprehensionexp_literalexp_nameexp_negationexp_parensexp_recordexp_section_leftexp_section_rightexp_sum_emptyexp_th_quoted_nameexp_tupleexp_type_applicationexp_unboxed_sumexp_unboxed_tupleexpentexportexport_namesexportsfieldfixityfloatforallforeign_exportforeign_importfunfunctionfundepfundepsgadt_constructorgdpatguardguard_equationguardshaskellheadimpentimplicit_paramimplicit_paridimportimport_con_namesimport_itemimport_listimport_packageinfixinst_datainstinst_tyinstinstanceinstance_headintegerlabelletmodifiermodulenamespacenewtypenewtype_constructoroperatorpat_applypat_aspat_fieldpat_fieldspat_infixpat_irrefutablepat_listpat_literalpat_namepat_negationpat_parenspat_recordpat_strictpat_tuplepat_typedpat_unboxed_tuplepat_viewpat_wildcardpatternpattern_guardpattern_synonympatternspragmapromotedqualqualified_constructorqualified_constructor_operatorqualified_modulequalified_operatorqualified_typequalified_type_operatorqualified_variablequantifiersquasiquotequasiquote_barquasiquote_bodyquasiquote_startquoterrecrecord_fieldsrole_annotationsafetysignaturesplicestmtstrict_typestringtickedtop_splicetransformtycon_arrowtypetype_aliastype_applytype_familytype_infixtype_instancetype_listtype_literaltype_nametype_operatortype_parenstype_roletype_startype_tupletype_unboxed_sumtype_unboxed_tupletype_variablevariablevaropviawherewildcard
-- RFC: What should `argumentOrParameter` match in the following case? fst :: (a, b) -> a fst tup@(x, y) = x -- ^^^^^^^^^^ <- 1️⃣ the whole pattern -- ^^^ <- 2️⃣ only the names of whole arguments (may not be given) -- ^^^ ^ ^ <- 3️⃣ all names in the left-hand side of the function
I would expect x and y to match here. What is the case for the other ones?
-- RFC: What should "branch" match? foo = bar where bar = 1 -- 1️⃣ `foo = bar` and `bar = 1` -- 2️⃣ `foo = bar where bar = 1` -- 3️⃣ `foo = bar where bar = 1` and `bar = 1`
what makes any of them a "branch"?
-- RFC: What should `argumentOrParameter` match in the following case? fst :: (a, b) -> a fst tup@(x, y) = x -- ^^^^^^^^^^ <- 1️⃣ the whole pattern -- ^^^ <- 2️⃣ only the names of whole arguments (may not be given) -- ^^^ ^ ^ <- 3️⃣ all names in the left-hand side of the functionI would expect
xandyto match here. What is the case for the other ones?
tupis the name of the first argument- the whole pattern is the structure of the whole first argument
xandyaren't the arguments to the function, but the first and second fields of the tuple
tup = (1, 2)
assert (fst tup == 1)
-- RFC: What should "branch" match? foo = bar where bar = 1 -- 1️⃣ `foo = bar` and `bar = 1` -- 2️⃣ `foo = bar where bar = 1` -- 3️⃣ `foo = bar where bar = 1` and `bar = 1`what makes any of them a "branch"?
all top-level defintions are branches, and it'd be odd to exclude single-branch branching constructs, e.g., having "branch" not match the branch in an if statement without an else
not :: Bool -> Bool
not True = False
not False = True
that's equivalent to
not :: Bool -> Bool
not x = case x of
True -> False
False -> True
and equivalent to
not :: Bool -> Bool
not x = if x the False else True
shall we make a haskell discussion so we can use threading? all the quoting is quickly going to become a headache 😅
note: this PR is semi-blocked on https://github.com/tree-sitter/tree-sitter-haskell/issues/111, which causes the parse tree to sometimes be wrong. For example see name.function34. If run individually, it is correct, if run as part of the whole suite, we get the wrong parse tree.
We could try to come up with a workaround if necessary, but for now we're hoping the issue gets fixed soon
note: this PR is semi-blocked on https://github.com/tree-sitter/tree-sitter-haskell/issues/111, which causes the parse tree to sometimes be wrong. For example see
name.function34. If run individually, it is correct, if run as part of the whole suite, we get the wrong parse tree.We could try to come up with a workaround if necessary, but for now we're hoping the issue gets fixed soon
@pokey Would you prefer we (1) move on with incorrect tests, (2) add a workaround which reinstantiates the parser between every run, or (3) fork and temporarily patch tree-sitter-haskell?
Note: This PR is currently blocked on the ongoing rewrite of the Haskell grammar (see #120).
Note: This PR is currently blocked on the ongoing rewrite of the Haskell grammar (see #120).
Just wanted to circle back to this --- it looks like that rewrite of the Haskell grammar has been merged in. But not trying to rush you or anything like that, obviously.
Note: This PR is currently blocked on the ongoing rewrite of the Haskell grammar (see #120).
Just wanted to circle back to this --- it looks like that rewrite of the Haskell grammar has been merged in. But not trying to rush you or anything like that, obviously.
It was, but it took a very long time and I got distracted with other things. Feel free to pick this up.
Note: This PR is currently blocked on the ongoing rewrite of the Haskell grammar (see #120).
Just wanted to circle back to this --- it looks like that rewrite of the Haskell grammar has been merged in. But not trying to rush you or anything like that, obviously.
It was, but it took a very long time and I got distracted with other things. Feel free to pick this up.
Got it, that makes sense! I probably won't be able to get to this super soon myself, but I'll at least try to look at it sometime in the next 3 months.