Tag: 哈斯克尔

是否有共同的Haskell运营商发音名称?

我正在读“ 学习你是一个很好的Haskell” ,我永远不知道如何发音Haskell运营商。 他们有“真实”的名字吗? ? 比如说,你怎么大声念出这样的表情呢? Just (+3) <*> Just 9 我知道>>=是“绑定”,但是其他的呢? 由于Google不考虑非字母数字字符,因此执行高效search很难。 我意识到你可以创build自己的操作符,所以当然不是所有的操作符都可以有名字,但我希望常用的名称(例如在Applicative或Monad定义的名称)必须有名称。

runST和函数组成

为什么这个types检查: runST $ return $ True 虽然以下不: runST . return $ True GHCI抱怨: Couldn't match expected type `forall s. ST s c0' with actual type `m0 a0' Expected type: a0 -> forall s. ST s c0 Actual type: a0 -> m0 a0 In the second argument of `(.)', namely `return' In the expression: runST . […]

在一个包含“Just”的Maybe中返回,

我有一个algorithm返回->Maybe ([(Int,Int)],(Int,Int)) 我想从另一个方法调用此方法,并对数据执行操作。 但是,返回值包含关键字Just因为它可能是。 第二种方法需要([(Int,Int)],(Int,Int)) ,因此不会除Just ([(Int,Int)],(Int,Int)) 。 有没有一种方法可以在应用第二种方法之前修剪? 我不完全理解在Just的使用 – 但是,我被告知第一个Method的返回types必须是Maybe 。