Haskell错误:解析错误输入'=' [英] Haskell Error: parse error on input `='
问题描述
GHC 6.12.1
Mac OS X 10.6。 4 x64
MacBook Pro
问题 我无法使用 我试着在 (不需要)解决方案 获得要编译的代码是 正确的代码: Specs GHC 6.12.1 Mac OS X 10.6.4 x64 MacBook Pro Problem I'm having trouble using I tried tabbing in (Undesirable) Solutions The only way I've gotten the code to compile is either
Saizan on #haskell explains that the assignments in a let expression have to align, not let itself. As long as the assignments line up, it's okay to use hard tabs or soft tabs. Correct code:
这篇关于Haskell错误:解析错误输入'='的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
let
语法。以下代码拒绝编译:
module Main其中
main = let x = 1
y = 2
z = 3
in putStrLn $X =++ show x ++\\\
Y =++ show y ++\\\
Z =++ show z
y = 2
和 z = 3
甚至更多。没有骰子。
let
子句,其中其中
子句。
模块主要其中
main = let
x = 1
y = 2
z = 3
in putStrLn $ X =++ show x ++\\\
Y =++ show y ++\\\
Z =++ show z
let
syntax. The following code refuses to compile:module Main where
main = let x = 1
y = 2
z = 3
in putStrLn $ "X = " ++ show x ++ "\nY = " ++ show y ++ "\nZ = " ++ show z
y = 2
and z = 3
even more. No dice.
let
clause with a where
clause.module Main where
main = let
x = 1
y = 2
z = 3
in putStrLn $ "X = " ++ show x ++ "\nY = " ++ show y ++ "\nZ = " ++ show z