我经常读到我不应该在Haskell中混合制表符和空格,或者我根本不应该使用制表符.为什么?
我正在尝试加载以下程序
gcd a b = if b == 0
then a
else gcd b (rem a b)
Run Code Online (Sandbox Code Playgroud)
但是我得到了错误
Prelude> :l euclidean.hs
[1 of 1] Compiling Main ( euclidean.hs, interpreted )
euclidean.hs:3:8:
Ambiguous occurrence `gcd'
It could refer to either `Main.gcd', defined at euclidean.hs:1:0
or `Prelude.gcd', imported from Prelude
Failed, modules loaded: none.
Run Code Online (Sandbox Code Playgroud)
我从改变函数名gcd来main和我
Couldn't match expected type `IO t'
against inferred type `a -> a -> a'
In the expression: main
When checking the type of …Run Code Online (Sandbox Code Playgroud)