我正在尝试编译一个Agda文件,但是我无法找到标准库。我见过文档here。
我用Stack安装它:
> which agda
/home/joey/.local/bin/agda
我已经为我的Agda目录设置了环境变量:
> echo $AGDA_DIR
/home/joey/.agda
其中填充了正确的文件:
/home/joey/agda/agda-stdlib/standard-library.agda-lib
> cat "$AGDA_DIR"/libraries
/home/joey/agda/agda-stdlib/standard-library.agda-lib
> cat "$AGDA_DIR"/defaults
standard-library
> cat /home/joey/agda/agda-stdlib/standard-library.agda-lib
name: standard-library
include: src
但是,当我去编译Agda文件时,我收到以下错误:
Failed to find source of module Function in any of the following
locations:
/home/joey/agda/AutoInAgda/src/Function.agda
/home/joey/agda/AutoInAgda/src/Function.lagda
/home/joey/.stack/snapshots/x86_64-linux-nopie/lts-8.14/8.0.2/share/x86_64-linux-ghc-8.0.2/Agda-2.5.2/lib/prim/Function.agda
/home/joey/.stack/snapshots/x86_64-linux-nopie/lts-8.14/8.0.2/share/x86_64-linux-ghc-8.0.2/Agda-2.5.2/lib/prim/Function.lagda
when scope checking the declaration
open import Function
如何告诉Agda在哪里寻找标准库?这是因为Stack的问题吗?
我正在使用Ubuntu 17.10,如果这有所不同。
答案 0 :(得分:4)
事实证明,如果根目录中有.agda-lib文件,它将完全忽略默认文件。所以关键是要在该文件中明确包含import java.io.IOException;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketError;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
@WebSocket
public class PrimarySocketHandler {
DataRetriever dr;
String reply;
@OnWebSocketClose
public void onClose(int statusCode, String reason) {
System.out.println("Close: statusCode=" + statusCode + ", reason=" + reason);
}
@OnWebSocketError
public void onError(Throwable t) {
System.out.println("Error: " + t.getMessage());
}
@OnWebSocketConnect
public void onConnect(Session session) {
System.out.println("Connected");
}
@OnWebSocketMessage
public void onMessage(Session session, String message) {
dr=new DataRetriever();
try {
reply=dr.retrieveQuotes(message);
} catch (Exception e1) {
e1.printStackTrace();
}
try {
session.getRemote().sendString(reply);
} catch (IOException e) {
e.printStackTrace();
}
}
}
。
让我错过的一件蠢事,但希望有同样问题的其他人会找到答案。