标签: eclipse-fp

如何找到cabal失败的地方和原因 - 无法解决依赖关系

我今天早上尝试安装几个模块以使Eclipse FP工作,scion-browser和buildwrapper失败.

[root@localhost ghc-mod]# cabal install scion-browser
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: scion-browser-0.3.0

[root@localhost ghc-mod]# cabal install buildwrapper
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: buildwrapper-0.8.0
Run Code Online (Sandbox Code Playgroud)

我简单地继续#haskell IRC,但无法得到答案,但我没有在IRC中长时间闲逛.然后我放弃了EclipseFP并与vim一起走上了快乐的道路.我之前使用过vim用于其他语言,我认为即使我可能没有调试器也会很好.但好奇心让我安装了一些插件,可以增强我在haskell的编码体验,但其中一个插件需要ghc-mod所以我想我会cabal install再去一次.我最终得到了以下错误.

[root@localhost ghc-mod]# cabal install ghc-mod
Resolving dependencies...
Configuring ghc-mod-0.3.0...
Building ghc-mod-0.3.0...
Preprocessing executable 'ghc-mod' for ghc-mod-0.3.0...
[1 of 6] Compiling Param            ( Param.hs, dist/build/ghc-mod/ghc-mod-tmp/Param.o )
[2 of 6] Compiling Lang             ( Lang.hs, dist/build/ghc-mod/ghc-mod-tmp/Lang.o )
[3 of 6] Compiling List             ( List.hs, dist/build/ghc-mod/ghc-mod-tmp/List.o )
[4 of …
Run Code Online (Sandbox Code Playgroud)

haskell cabal cabal-install eclipse-fp

6
推荐指数
0
解决办法
1573
查看次数

Haskell:Interact使用导致错误

我正在尝试使用交互功能,但我遇到以下代码的问题:

main::IO()
main = interact test

test :: String -> String
test [] = show 0
test a = show 3
Run Code Online (Sandbox Code Playgroud)

我正在使用EclipseFP并且输入一个输入似乎有错误.尝试再次运行main会导致:

*** Exception: <stdin>: hGetContents: illegal operation (handle is closed)
Run Code Online (Sandbox Code Playgroud)

我不确定为什么这不起作用,测试类型是String - > String并且show是Show a => a - > String,所以看起来它应该是一个有效的交互输入.

编辑/ UPDATE

我尝试了以下,它工作正常.如何使用unlines和lines导致交互按预期工作?

main::IO()
main = interact respondPalindromes

respondPalindromes :: String -> String
respondPalindromes =
    unlines .
    map (\xs -> if isPal xs then "palindrome" else "not a palindrome") .
    lines

isPal :: String -> Bool
isPal xs = …
Run Code Online (Sandbox Code Playgroud)

haskell eclipse-fp

4
推荐指数
1
解决办法
650
查看次数

比较Haskell中的列表元素

我只是在学习Haskell而且有点卡住了.我想比较列表元素并测量它们之间的差异并返回最高的元素.不幸的是,我不知道如何解决这个问题.通常,我只是迭代列表并比较邻居,但这似乎不是Haskell的方式.我已经尝试过使用,map但正如我所说,我真的不知道如何解决这个问题.我会感谢各种建议!

最好的祝愿

编辑:我的想法是首先拉链这样的所有对pairs a = zip a (tail a).然后我想得到所有的差异(可能与map?)然后只选择最高的一个.我只是无法处理Haskell语法.

haskell eclipse-fp

1
推荐指数
1
解决办法
4566
查看次数

标签 统计

eclipse-fp ×3

haskell ×3

cabal ×1

cabal-install ×1