我对点运算符有点困惑。我有以下代码(用于测试): test :: Int -> Int -> Int
test x y = f1 . f2 x y
where f1 n = n+1
f2 x' y' = x' * y'
而且我想它会首先执行该结果(F2 x和y),然后F1,而是它抛出一个错误。任何人都可以告诉我点运算符的确切定义和什么等于f1。 f2 x y?
在this question中,作者在Haskell中编写了de Morgan原则的实现。我理解的notAandnotB,并notAornotB的实现,但我努力理解的notAorB执行当中是: notAorB :: (Either a b -> c) -> (a -> c, b -> c)
notAorB f = (f . Left, f . Right)
有人能解释如何(f . Left,
我有一个函数,它使用了Dot运算符。现在我想写它没有点。我怎样才能做到这一点? all p = and . map p
这是正确的吗? all p = and (map p)
我得到这些错误: 4.hs:8:13:
Couldn't match expected type `[Bool]'
with actual type `[a0] -> [b0]'