[英]Leksah 0.15.0.1, GHC 7.10.1 : Is it possible to pass user input to a Haskell program which is launched inside Leksah Haskell IDE? If yes, how?
[英]haskell code compiles on leksah but not ghc
正如問題所述,我有一些在leksah中編譯,但不使用ghc --make filename.hs
編譯
編碼:
module Main (
main
) where
pair a b = (Pair (a, b))
newtype Pair a b = Pair (a,b) deriving (Eq,Show)
instance (Num a,Num b) => Num (Pair a b) where
Pair (a,b) + Pair (c,d) = Pair (a+c,b+d)
Pair (a,b) * Pair (c,d) = Pair (a*c,b*d)
Pair (a,b) - Pair (c,d) = Pair (a-c,b-d)
abs (Pair (a,b)) = Pair (abs a, abs b)
signum (Pair (a,b)) = Pair (signum a, signum b)
fromInteger i = Pair (fromInteger i, fromInteger i)
main = do
a <- return (pair 1 3)
print a
print "haha"
print 3.2
print [3,4,3]
我需要調用一個選項來使其與ghc --make
運行嗎?
免責聲明:我沒有成對新類型 。
編輯:
當使用ghc --make Bignumber.hs
(Bignumber.hs是文件名)輸出時
[1 of 1] Compiling Main ( BigNumber.hs, BigNumber.o )
BigNumber.hs:20:13: parse error on input `print'
檢查你的縮進:也許你正在以一種ghc解釋方式與leksah不同的方式混合制表符和空格? 我沒有看到print
解析錯誤的另一種解釋。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.