我已经从终端在Xubuntu 13.10上安装了Leksah 0.12.1.3。
sudo apt-get install leksah打开leksah,创建新的工作区和包。默认情况下,使用'Hello world‘程序创建Main.hs。
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 ==========================
就会出现。
发布于 2014-01-11 01:57:20
这种事经常发生在我身上...我不知道原因是什么,但(至少在我的情况下)我知道我可以通过使用命令行来解决这个问题。我只需"cd“进入包含该软件包的目录(包含*.cabal文件的那个目录),然后输入
cabal configure
cabal build完成此操作后,Leksah将正常工作。显然,这是一个Leksah错误,但它很容易解决。
发布于 2014-01-11 06:10:00
问题出在我天真地假设'apt-get install leksah‘会安装所有需要的包。然而,这是不正确的。
在安装leksah之后,您将需要:
apt-get install cabal-install
apt-get install ghc
cabal update之后,正如jamshidh所提到的,您需要单击package->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"发布于 2014-03-05 14:08:00
默认hello world的问题是下面这行:
putStrLn (hello "World") 这只是因为左引号没有放在正确的位置。将其更改为
putStrLn ("hello World") 它应该是有效的。
https://stackoverflow.com/questions/21045586
复制相似问题