diff --git a/src/Code/Syntax/SyntaxSegmentHelp.elm b/src/Code/Syntax/SyntaxSegmentHelp.elm index db87e109..a0b8fb55 100644 --- a/src/Code/Syntax/SyntaxSegmentHelp.elm +++ b/src/Code/Syntax/SyntaxSegmentHelp.elm @@ -50,17 +50,19 @@ textLiteral = textLiteralMultiline : Html msg textLiteralMultiline = - text "A multi-line `Text` literal. These values preserve whitespace and line breaks. " + help + [ text "A multi-line ", inlineCode "Text", text " literal. These values preserve whitespace and line breaks. " ] bytesLiteral : Html msg bytesLiteral = - text "A `Bytes` literal. An arbitrary-length 8-bit byte sequence." + help + [ text "A ", inlineCode "Bytes", text " literal. An arbitrary-length 8-bit byte sequence." ] charLiteral : Html msg charLiteral = - text "A `Char` literal: `Char` is the type for a single Unicode character." + help [ text "A ", inlineCode "Char", text " literal: ", inlineCode "Char", text " is the type for a single Unicode character." ] @@ -69,12 +71,12 @@ charLiteral = cons : Html msg cons = - text "Extracts the head element of a list from its tail and binds each to a variable, for example: `head +: tail`. " + help [ text "Extracts the head element of a list from its tail and binds each to a variable, for example: ", inlineCode "head +: tail", text ". " ] snoc : Html msg snoc = - text "Extracts the last element of a list and binds the two segments to variables, for example: `prefix :+ last`." + help [ text "Extracts the last element of a list and binds the two segments to variables, for example: ", inlineCode "prefix :+ last", text "." ] @@ -83,32 +85,32 @@ snoc = typeKeyword : Html msg typeKeyword = - text "Introduces a type definition. By default, `type` introduces a unique type: one which will be referenced by its name." + help [ text "Introduces a type definition. By default, ", inlineCode "type", text " introduces a unique type: one which will be referenced by its name." ] typeParams : Html msg typeParams = - text "A lowercase value in a type signature introduces a type parameter " + help [ text "A lowercase value in a type signature introduces a type parameter " ] typeForall : Html msg typeForall = - text "`forall` describes a type that is universally quantified." + help [ inlineCode "forall", text " describes a type that is universally quantified." ] typeAscriptionColon : Html msg typeAscriptionColon = - text "In a type signature, the colon separates the name of a function from its type. The colon can be read as \"has type\"." + help [ text "In a type signature, the colon separates the name of a function from its type. The colon can be read as \"has type\"." ] uniqueKeyword : Html msg uniqueKeyword = - text "Introduces a nominal type: one which will be referenced by its name, as opposed to one which is identified by its structure." + help [ text "Introduces a nominal type: one which will be referenced by its name, as opposed to one which is identified by its structure." ] structuralKeyword : Html msg structuralKeyword = - text "Introduces a structural type: one which is identified and unique to its structure, not by its name." + help [ text "Introduces a structural type: one which is identified and unique to its structure, not by its name." ] @@ -117,12 +119,24 @@ structuralKeyword = typeLink : Html msg typeLink = - text "`typeLink` takes a Unison type as an argument and turns it into a value of `Link.Type`. Most commonly used in error messages or the `Doc` type." + help + [ inlineCode "typeLink" + , text " takes a Unison type as an argument and turns it into a value of " + , inlineCode "Link.Type" + , text ". Most commonly used in error messages or the " + , inlineCode "Doc" + , text " type." + ] termLink : Html msg termLink = - text "`termLink` takes a Unison term as an argument and creates a value of `Link.Term`." + help + [ inlineCode "termLink" + , text " takes a Unison term as an argument and creates a value of " + , inlineCode "Link.Term" + , text "." + ] @@ -131,17 +145,37 @@ termLink = matchWith : Html msg matchWith = - text "Introduces a way to check a value against a pattern. The expression to the right of `match` is the target value of the match, and the statement(s) following `with` are the potential patterns." + help + [ text "Introduces a way to check a value against a pattern. The expression to the right of " + , inlineCode "match" + , text " is the target value of the match, and the statement(s) following " + , inlineCode "with" + , text "are the potential patterns." + ] cases : Html msg cases = - text "`cases` is syntactic sugar for a `match statement`. For example, `match a with a1` could be shortened `cases a1`." + help + [ text "It's common to pattern match on a function argument, like " + , inlineCode "(a -> match a with a1 -> ... )" + , text ". " + , inlineCode "cases" + , text "shortens this to" + , inlineCode "cases a1 -> ..." + , text "." + ] asPattern : Html msg asPattern = - text "In a pattern match,`@` is an \"as-pattern\". It is a way of binding a variable to an element in the pattern match. The value to the left of the `@` is the variable name and the value to the right is what the variable references." + help + [ text "In a pattern match, " + , inlineCode "@" + , text "is an \"as-pattern\". It is a way of binding a variable to an element in the pattern match. The value to the left of the " + , inlineCode "@" + , text " is the variable name and the value to the right is what the variable references." + ] @@ -150,7 +184,15 @@ asPattern = ifElse : Html msg ifElse = - text "A conditional statement. If the `Boolean` expression argument is `true`, the first branch of the statement will be executed, if it is `false`, the second branch will be run instead. " + help + [ text "A conditional statement. If the " + , inlineCode "Boolean" + , text "expression argument is " + , inlineCode "true" + , text ", the first branch of the statement will be executed, if it is " + , inlineCode "false" + , text ", the second branch will be run instead." + ] @@ -159,7 +201,11 @@ ifElse = use : Html msg use = - text "A `use` clause tells Unison to allow identifiers from a given namespace to be used without prefixing in the lexical scope where the use clause appears." + help + [ text "A " + , inlineCode "use" + , text " clause tells Unison to allow identifiers from a given namespace to be used without prefixing in the lexical scope where the use clause appears." + ] @@ -168,32 +214,58 @@ use = abilityWhere : Html msg abilityWhere = - text "Introduces an ability definition. The name of the ability follows the keyword and the operations that the ability can perform are listed as function signatures after the `where` keyword. " + help + [ text "Introduces an ability definition. The name of the ability follows the keyword and the operations that the ability can perform are listed as function signatures after the " + , inlineCode "where" + , text " keyword. " + ] abilityBraces : Html msg abilityBraces = - text "Defines the set of abilities that a function can perform. The abilities will appear in a comma-delimited list. " + help [ text "Defines the set of abilities that a function can perform. The abilities will appear in a comma-delimited list. " ] handleWith : Html msg handleWith = - text "The `handle` keyword indicates that a function is an ability handler. The first argument is an expression performing a particular ability to handle and what follows dictates how the ability should be handled." + help + [ text "The " + , inlineCode "handle" + , text " keyword indicates that a function is an ability handler. The first argument is an expression performing a particular ability to handle and what follows dictates how the ability should be handled." + ] doKeyword : Html msg doKeyword = - text "`do` introduces a delayed computation, something with the form `() -> a`." + help + [ inlineCode "do" + , text " introduces a delayed computation, something with the form " + , inlineCode "() -> a" + , text "." + ] delayed : Html msg delayed = - text "In a type signature, `'` indicates an argument is delayed, so `'`a means `() -> a`. In a function body, `'` indicates that the term immediately to the right is delayed. " + help + [ text "In a type signature, " + , inlineCode "'" + , text "indicates an argument is delayed, so " + , inlineCode "'a" + , text " means " + , inlineCode "() -> a" + , text ". In a function body, " + , inlineCode "'" + , text " indicates that the term immediately to the right is delayed. " + ] forceParens : Html msg forceParens = - text "`()` forces the evaluation of a delayed computation." + help + [ inlineCode "()" + , text "forces the evaluation of a delayed computation." + ] @@ -202,9 +274,19 @@ forceParens = concat : Html msg concat = - text "Matches a list that is composed of the concatenation of two sub-lists. At least one of the sub-lists must be a pattern with a known length, commonly indicated by square brackets: `[a, b] ++ tail`." + help + [ text "Matches a list that is composed of the concatenation of two sub-lists. At least one of the sub-lists must be a pattern with a known length, commonly indicated by square brackets: " + , inlineCode "[a, b] ++ tail" + , text "." + ] unit : Html msg unit = - text "Unit is the type which represents a no-argument tuple `()`. Its one data constructor is also written `()`." + help + [ text "Unit is the type which represents a no-argument tuple " + , inlineCode "()" + , text ". Its one data constructor is also written " + , inlineCode "()" + , text "." + ]