相关疑难解决方法(0)

为什么我不应该混合标签和空格?

我经常读到我不应该在Haskell中混合制表符和空格,或者我根本不应该使用制表符.为什么?

syntax whitespace haskell indentation

27
推荐指数
1
解决办法
3401
查看次数

基础程序无法加载(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)

我从改变函数名gcdmain和我

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)

haskell

2
推荐指数
1
解决办法
215
查看次数

标签 统计

haskell ×2

indentation ×1

syntax ×1

whitespace ×1