![](/img/trans.png)
[英]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.