Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/end-to-end.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ testCases(endToEnd, code => code)('end-to-end tests', [
either.makeRight('output'),
],
[':match({ a: A })({ tag: a, value: {} })', either.makeRight('A')],
[':{string concatenate}(a)(b)', either.makeRight('ba')],
[':{atom concatenate}(a)(b)', either.makeRight('ba')],
[
':flow({ :string.concatenate(a) :string.concatenate(b) })(z)',
':flow({ :atom.concatenate(a) :atom.concatenate(b) })(z)',
either.makeRight('zab'),
],
[
Expand Down
8 changes: 4 additions & 4 deletions src/language/runtime/keywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const runtimeContext = makeObjectNode({
arguments: makeObjectNode({
lookup: makeFunctionNode(
{
parameter: types.string,
return: types.option(types.string),
parameter: types.atom,
return: types.option(types.atom),
},
unserializableFunction,
option.none,
Expand Down Expand Up @@ -71,8 +71,8 @@ const runtimeContext = makeObjectNode({
environment: makeObjectNode({
lookup: makeFunctionNode(
{
parameter: types.string,
return: types.option(types.string),
parameter: types.atom,
return: types.option(types.atom),
},
unserializableFunction,
option.none,
Expand Down
23 changes: 10 additions & 13 deletions src/language/semantics/prelude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ export const prelude: ObjectNode = makeObjectNode({
['object', 'lookup'],
{
// TODO
parameter: types.string,
parameter: types.atom,
return: types.something,
},
key => {
Expand Down Expand Up @@ -494,33 +494,30 @@ export const prelude: ObjectNode = makeObjectNode({
),
}),

string: makeObjectNode({
atom: makeObjectNode({
concatenate: preludeFunction(
['string', 'concatenate'],
['atom', 'concatenate'],
{
parameter: types.string,
parameter: types.atom,
return: makeFunctionType('', {
parameter: types.string,
return: types.string,
parameter: types.atom,
return: types.atom,
}),
},
string2 =>
either.makeRight(
makeFunctionNode(
{
parameter: types.string,
return: types.string,
parameter: types.atom,
return: types.atom,
},
serializePartiallyAppliedFunction(
['string', 'concatenate'],
string2,
),
serializePartiallyAppliedFunction(['atom', 'concatenate'], string2),
option.none,
string1 => {
if (typeof string1 !== 'string' || typeof string1 !== 'string') {
return either.makeLeft({
kind: 'panic',
message: 'concatenate received a non-string argument',
message: 'concatenate received a non-atom argument',
})
} else {
return either.makeRight(string1 + string2)
Expand Down
Loading
Loading