$
.
{ propertyId(
propertyValue)
}
{"name": "Keli", "age": 20}
. In fact, it is actually a polyfunc invocation, where the parameters are $
, "Keli"
and 20
while the function name is name
age
.$.name(String) age(Int)
.objectExpr.
propertyId
person
wants to decrease its car's price by 10%.Int
not String
.Shape
for further explanation.tagExpr.
{ carrylessTagBranch | carryfulTagBranch | elseBranch }
carrylessTagBranch =if
(
.
tagId)
:
**(
branchExpr)
carryfulTagBranch =if
(
.
tagId(
constId)
})
:
(
branchExpr)
defaultBranch =else
(
branchExpr)
Shape
.Shape.Circle(3).area
28.2743
Shape.Rectangle($.height(3) width(4)).area
12.0
Shape.Empty
0.0
else
.Shape.Circle(3).isEmpty
Boolean.false
Shape.Rectangle($.height(3) width(4)).isEmpty
Boolean.false
Shape.Empty.isEmpty
Boolean.true
else
branch is present.else
branch is present for non-exhaustive matching.Animal
can fly or not:b
and c
are not used at all, so we actually erase them out to have a less noisy code as follows:ffi
.
javascript
(
"
javascriptCode"
)
undefined
, thus we need to cast it explicitly using the magic function as
.k$
. For example, if the identifier is x
is Keli, then it will be transpiled as k$x
in JavaScript.Boolean
type is not built-in to Keli, but rather defined in the Prelude, we cannot use True
or False
in JavaScript, but rather k$Boolean.k$True
or k$Boolean.k$False
. Similarly, any other tagged union can be returned from the JavaScript code using the following grammar:$
taggedUnionId.
$
tagId