是否可以在需要时调用 Node.js 模块中的函数。
应用程序.js
const Database = require('./database').Database;
const UsersModel = require('./model').Model; // pass the name = Users and database
const AdminsModel = require('./model').Model; // pass the name = Admins and database
Run Code Online (Sandbox Code Playgroud)
数据库.js
export class Database {
// some functions here
}
Run Code Online (Sandbox Code Playgroud)
模型.js
export class Model {
onModelCreated(name, database) {
this.name = name;
this.database = database;
}
insert() {}
find() {}
delete() {}
update() {}
}
Run Code Online (Sandbox Code Playgroud) 这是我的程序:
modify :: Integer -> Integer
modify a = a + 100
x = x where modify(x) = 101
Run Code Online (Sandbox Code Playgroud)
在 ghci 中,编译成功,但是当我尝试打印 x 时,终端卡住了。Haskell 中是否无法从函数输出中找到输入?