相关疑难解决方法(0)

为什么Haskell中没有隐式并行性?

Haskell功能强大且纯粹,所以基本上它具有编译器能够处理隐式并行性所需的所有属性.

考虑这个简单的例子:

f = do
  a <- Just 1
  b <- Just $ Just 2
  -- ^ The above line does not utilize an `a` variable, so it can be safely
  -- executed in parallel with the preceding line
  c <- b
  -- ^ The above line references a `b` variable, so it can only be executed
  -- sequentially after it
  return (a, c)
  -- On the exit from a monad scope we wait for all computations to …
Run Code Online (Sandbox Code Playgroud)

parallel-processing concurrency haskell compiler-optimization

57
推荐指数
3
解决办法
4487
查看次数