是否有人使用Haskell开发的分隔延续,特别是Web开发?我觉得这个话题很吸引人,我需要的东西比我学习的东西更容易获得.
以下是我到目前为止找到的资源:
谢谢!
-deech
Literate Haskell是否支持索引函数名,类型类和变量引用?是否有一个我可以在Literate Haskell源上运行的过滤器,它将执行此操作,并为我提供一个很好的PDF手册或一个超链接的HTML文档.
这些是noweb和CWEB的一个非常好的功能,我认为它会刺激Literate Haskell的广泛采用.
例如,查看用CWEB编写的单词计数程序.项目#4中第一页上的代码块使用了该代码的使用位置.LHS不支持块,但我想知道代码的使用位置:
评论func.
func = id
用于:(XYZf,ABCg,第1.5节)
func2 = indefined
用于:(ABCx,第2.1节)
此外,还有一个索引,它汇总了所有函数名称和变量,以及它们在文档中引用的位置以及其他函数等.
我有一个Haskell项目,旨在创建一些C++绑定.我编写了C包装器并将它们编译成一个独立的静态链接库.
我想编写Haskell绑定以静态链接到C包装器,这样我就不必单独分发C包装器,但我似乎无法使它工作,并希望得到一些帮助.
我指定C库作为额外的库,但我的cabal build
步骤似乎没有将它添加到编译命令.
我已经创建了一个小项目来说明这一点(http://github.com/deech/CPlusPlusBindings).
它包含一个小的C++类(https://github.com/deech/CPlusPlusBindings/tree/master/cpp-src),C包装器(https://github.com/deech/CPlusPlusBindings/tree/master/c- src),一个工作的C测试例程(https://github.com/deech/CPlusPlusBindings/tree/master/c-test)和Haskell文件(https://github.com/deech/CPlusPlusBindings/blob/master/ src/BindingTest.chs).
在Setup.hs中添加了C库,而不是在Cabal文件中,因为这就是我的实际项目,它在构建步骤之前使用"make"通过Cabal构建C库.我已经验证在构建步骤中,extraLibs
部分BuildInfo
包含库名称并extraLibDirs
包含正确的目录.
我的输出cabal build
是:
creating dist/setup
./dist/setup/setup build --verbose=2
creating dist/build
creating dist/build/autogen
Building CPlusPlusBinding-0.1.0.0...
Preprocessing library CPlusPlusBinding-0.1.0.0...
Building library...
creating dist/build
/usr/local/bin/ghc --make -fbuilding-cabal-package -O -odir dist/build -hidir dist/build -stubdir dist/build -i -idist/build -isrc -idist/build/autogen -Idist/build/autogen -Idist/build -I/home/deech/Old/Haskell/CPlusPlusBinding/c-src -I/home/deech/Old/Haskell/CPlusPlusBinding/cpp-includes -optP-include -optPdist/build/autogen/cabal_macros.h -package-name CPlusPlusBinding-0.1.0.0 -hide-all-packages -package-db dist/package.conf.inplace -package-id base-4.6.0.1-8aa5d403c45ea59dcd2c39f123e27d57 -XHaskell98 -XForeignFunctionInterface BindingTest
Linking... …
Run Code Online (Sandbox Code Playgroud) 我昨天正在尝试使用类型系列,并遇到以下代码遇到障碍:
{-# LANGUAGE TypeFamilies #-}
class C a where
type A a
myLength :: A a -> Int
instance C String where
type A String = [String]
myLength = length
instance C Int where
type A Int = [Int]
myLength = length
main = let a1 = [1,2,3]
a2 = ["hello","world"]
in print (myLength a1)
>> print (myLength a2)
Run Code Online (Sandbox Code Playgroud)
这里我有一个与C类相关的类型和一个计算相关类型长度的函数.但是上面的代码给了我这个错误:
/tmp/type-families.hs:18:30:
Couldn't match type `A a1' with `[a]'
In the first argument of `myLength', namely `a1'
In the first argument …
Run Code Online (Sandbox Code Playgroud) 我有以下测试类,它使用泛型来重载方法.它在使用javac编译时有效,无法在Eclipse Helios中编译.我的java版本是1.6.0_21.
我读到的所有文章都表明Eclipse是对的,这段代码不适用.但是,使用javac和run编译时,会选择正确的方法.
这怎么可能?
谢谢!
import java.util.ArrayList;
public class Test {
public static void main (String [] args) {
Test t = new Test();
ArrayList<String> ss = new ArrayList<String>();
ss.add("hello");
ss.add("world");
ArrayList<Integer> is = new ArrayList<Integer>();
is.add(1);
is.add(2);
System.out.println(t.getFirst(ss));
System.out.println(t.getFirst(is));
}
public String getFirst (ArrayList<String> ss) {
return ss.get(0);
}
public Integer getFirst (ArrayList<Integer> ss) {
return ss.get(0);
}
}
Run Code Online (Sandbox Code Playgroud)