Locque authoring
Use this skill when writing or editing Locque source or tests.
Sources of truth
- •
grammar.mddefines the canonical syntax and S-expr mapping. - •
AGENTS.mdlists project conventions and tooling.
Workflow
- •Prefer
.lqM-expr files; do not handwrite.lqs. - •Keep paths lowercase. Every
lib/**file must have a matchingtest/**file. - •Use
Module::namequalification;open Alias exposing ... endis explicit only. - •Effects are explicit: computations are values via
compute ... end, run viaperform. - •Multiline constructs must end with
end(function,compute,bind,match,data,typeclass,instance,module,open,pack,unpack). - •Data:
define ... as data ... in TypeN ... endwith constructorsType::Ctor; match usescase Type::Ctor. - •No implicit coercions; use
of-type,lift,up,down,pack,unpackas needed. - •Use
ignoredinstead of_for unused binders. - •List literals are canonical:
[]and[a, b](commas required). Empty lists requireof-type [] (List A)when no expected list type is in scope.
Test conventions
- •Use
assert::assert-eqwith an explicit type argument. - •Run
smyth testafter changes.
Templates
Function:
locque
# Assumes: import arithmetic as Ar
define transparent inc as
function x Natural returns Natural value
Ar::add x 1
end
Data:
locque
define transparent Option as data A Type0 in Type0 case Option::none of-type Option A case Option::some of-type for-all x as A to Option A end