小编Nat*_*ski的帖子

Type签名缺少适当的绑定[Haskell]

我一直在谷歌上寻找答案,甚至在这里问了几个问题.这似乎是一个模棱两可的错误,我无法弄清楚如何在我的实例中解决它.

违规代码如下:

pos :: (Eq a) => [a] -> a -> Int
pos [] _ = -1
pos (x:xs) y
| not $ elem y (x:xs) = -1
| x == y =  0
| otherwise = 1 + pos xs y

-- Get the same element from another range as one element of the first range.
refPos :: (Eq a) => [a] -> [b] -> a -> b
refPos r1 r2 e1 = r2 !! (r1 `pos` e1)

letterNumber …
Run Code Online (Sandbox Code Playgroud)

haskell types compilation

3
推荐指数
1
解决办法
2715
查看次数

为什么1 ... 2等价于PHP中的“ 10.2”?

仅仅一秒钟之前,我正在使用PHP,试图弄清楚是否存在本机范围函数(最终找到range)。但是,我尝试的事情之一是:

echo 1...2;
Run Code Online (Sandbox Code Playgroud)

令我惊讶的是返回字符串"10.2"。谁能确切告诉我是什么语法引起的?对于splat操作员来说,这似乎不是一个有效的地方。

php symbols operators type-conversion

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

标签 统计

compilation ×1

haskell ×1

operators ×1

php ×1

symbols ×1

type-conversion ×1

types ×1