String interpolation - xarvh/squarepants GitHub Wiki

NO INTERPOLATION

The .. binop concatenates strings.

try uniCanBeCastTo { given = full1.uni, required = full2.uni } as

    'canBeCastNo []:
        addErError env currentEquality ("Function call par " .. Text.fromNumber index .. " with wrong uniqueness") @state

VARIABLE

#variableName will be replaced with the content of variableName. It must be of type Text.

try uniCanBeCastTo { given = full1.uni, required = full2.uni } as

    'canBeCastNo []:
        indextT = Text.fromNumber index
        age = getAge env
        addErError env currentEquality "Function call par #indexT with wrong uniqueness and #age" @state

FUNCTION

Text is a function that takes a record.

try uniCanBeCastTo { given = full1.uni, required = full2.uni } as

    'canBeCastNo []:
        {
        , index = Text.fromNumber index
        , age = getAge env
        }
        >> "Function call par #index with wrong uniqueness and #age"
        >> addErError env currentEquality __ @state

Verdict

I'm probably going with the VARIABLE method. It needs more variables, but it's otherwise simpler and it reduces the need for parens.