2014-01-10 53 views
1

我已經在終端Xubuntu 13.10上安裝了Leksah 0.12.1.3。Leksah默認你好世界安裝後不工作Xubuntu 13.10

sudo apt-get install leksah 

打開leksah,創建新的工作區和包。 Main.hs默認使用'Hello world'程序創建。

module Main (
    main 
) where 

import Control.Monad (unless) 
import Data.List (stripPrefix) 
import System.Exit (exitFailure) 
import Test.QuickCheck.All (quickCheckAll) 

-- Simple function to create a hello message. 
hello s = "Hello " ++ s 

-- Tell QuickCheck that if you strip "Hello " from the start of 
-- hello s you will be left with s (for any s). 
prop_hello s = stripPrefix "Hello " (hello s) == Just s 

-- Hello World 
exeMain = do 
    putStrLn (hello "World") 

-- Entry point for unit tests. 
testMain = do 
    allPass <- $quickCheckAll -- Run QuickCheck on all prop_ functions 
    unless allPass exitFailure 

-- This is a clunky, but portable, way to use the same Main module file 
-- for both an application and for unit tests. 
-- MAIN_FUNCTION is preprocessor macro set to exeMain or testMain. 
-- That way we can use the same file for both an application and for tests. 
#ifndef MAIN_FUNCTION 
#define MAIN_FUNCTION exeMain 
#endif 
main = MAIN_FUNCTION 

現在,如果我嘗試運行包,或在編輯寫東西,在右下的窗口
========== ========== 127 ================
出現。

+0

您是否啓用了'CPP'擴展?此外,在.cabal文件中設置測試,而不是使用語言編譯指示,會更容易。有更好的方法來做到這一點。至少嘗試直接定義'main = exeMain'。另外,如果它不與GHC一起編譯,它將不會與leksah一起編譯。在承擔編輯器問題之前,確保它不是代碼問題。 – bheklilr

回答

2

這發生在我身上很多....我不知道是什麼原因,但(至少在我的情況下)我知道我可以通過使用命令行來解決問題。我只是「CD」與包(一個與* .cabal文件)的目錄,然後鍵入

cabal configure 
cabal build 

這樣做了之後,Leksah正常工作。顯然這是一個Leksah錯誤,但它很容易解決。

1

問題出在我天真的假設'apt-get install leksah'將安裝所有需要的軟件包。 但是,這是不正確的。

leksah安裝之後,你將需要:

apt-get install cabal-install 
apt-get install ghc 
cabal update 

之後,根據jamshidh提到的,你需要點擊套餐 - > cofigure。

現在建立與制動器(方案張貼在的問題,這是leksah自動生成默認):

Couldn't match type `IO' with `[]' 
Expected type: String 
    Actual type: IO() 
In the first argument of `putStrLn', namely `testMain' 
In the expression: putStrLn testMain 
In an equation for `main': main = putStrLn testMain 

但我設法建立更簡單的版本:

module Main (
    main 
) where 
main = putStrLn "Hello World" 
-1

用默認的問題你好,世界是如下行:

putStrLn (hello "World") 

這簡直就是左派te不在正確的位置。改爲

putStrLn ("hello World") 

它應該工作。

+0

這不是問題,請再次閱讀源代碼。 – IARI