@@ -27,7 +27,7 @@ import { OpInfixExp } from "src/schemas/nodes/exps/infix";
2727import { nativeToIntExp } from "src/schemas/nodes/exps/int" ;
2828import { type Exp , isIdentExp } from "src/schemas/nodes/exps/union" ;
2929import type { Program } from "src/schemas/nodes/program" ;
30- import { BlockStmt } from "src/schemas/nodes/stmts/block" ;
30+ import type { BlockStmt } from "src/schemas/nodes/stmts/block" ;
3131import type { Stmt } from "src/schemas/nodes/stmts/union" ;
3232import { type KNode , matchKnode , nodeString } from "src/schemas/nodes/union" ;
3333import type { PrefixOperator } from "src/schemas/prefix-operator" ;
@@ -232,51 +232,29 @@ export const evalDiff = (diffExp: DiffExp) =>
232232 ) ,
233233 ) ,
234234 ) . pipe (
235- Effect . flatMap ( ( args ) =>
235+ Effect . flatMap ( ( convertedArgs ) =>
236236 Effect . succeed (
237237 CallExp . make ( {
238- token : { _tag : "fn" , literal : "fn" } ,
239- fn : FuncExp . make ( {
240- token : { _tag : "fn" , literal : "fn" } ,
241- parameters : diffExp . params , // LIMITATION TO A SINGLE VARIABLE FUNCTIONS.
242- body : BlockStmt . make ( {
243- token : { _tag : "!" , literal : "!" } , // FIX eventually
244- statements : [
245- ExpStmt . make ( {
246- token : {
247- _tag : "!" ,
248- literal : "!" ,
249- } ,
250- expression : CallExp . make ( {
251- token : {
252- _tag : "!" ,
253- literal : "!" ,
254- } ,
255- fn : Match . value ( fn ) . pipe (
256- Match . tag ( "BuiltInObj" , ( { fn } ) =>
257- IdentExp . make ( {
258- token : { _tag : "IDENT" , literal : fn } ,
259- value : fn ,
260- } ) ,
261- ) ,
262- Match . tag ( "FunctionObj" , ( { params, body } ) =>
263- FuncExp . make ( {
264- token : fnTokenSchema . make ( {
265- literal : "fn" ,
266- } ) ,
267- parameters : params ,
268- body,
269- } ) ,
270- ) ,
271- Match . exhaustive ,
272- ) ,
273- args,
274- } ) ,
238+ token : { _tag : "(" , literal : "(" } ,
239+ fn : Match . value ( fn ) . pipe (
240+ Match . tag ( "BuiltInObj" , ( { fn } ) =>
241+ IdentExp . make ( {
242+ token : { _tag : "IDENT" , literal : fn } ,
243+ value : fn ,
244+ } ) ,
245+ ) ,
246+ Match . tag ( "FunctionObj" , ( { params, body } ) =>
247+ FuncExp . make ( {
248+ token : fnTokenSchema . make ( {
249+ literal : "fn" ,
275250 } ) ,
276- ] ,
277- } ) ,
278- } ) ,
279- args,
251+ parameters : params ,
252+ body,
253+ } ) ,
254+ ) ,
255+ Match . exhaustive ,
256+ ) ,
257+ args : convertedArgs ,
280258 } ) ,
281259 ) ,
282260 ) ,
0 commit comments