Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Appendix A: Keywords

The following list contains keywords that are reserved for current or future use by the Halcyon language. As such, they cannot be used as identifiers.

Keywords Currently in Use

The following is a list of keywords currently in use, with their functionality described.

KeywordUseExample
module, endDeclares the beginning and end of a module respectivelymodule demo = ... end
importImports a function from another language, such as JavaScript or C
letDefines a variablelet myint = 5
doExecutes an expression (like a main function)do string::print "Hi"
typeDefines a new type, or type aliastype twoints = (std::int, std::int)
match, withMatches a discriminant with one or more patternsmatch myint with |4 => ... |5 => ...
if,then,elseEvaluates to a value based on a boolean expressionif myint == 5 then ... else ...
fnDeclares a functionlet myfn = fn a => a + 1
ofDenotes types that a constructor name containstype result = fn A B => Ok of A | Error of B
inLimits a variable's scope to the next expressionlet myint = 5 in let mynewint = myint + 1