当我运行这个 Haskell 片段时,它只加载了 1 个 CPU。两者f
和g
都是无意义的,但它不应该在可用时加载两个 CPU 吗?编译为ghc -O2 snippet.hs
.
f x = 1 + (f $! x)
g x = 5 + (g $! x)
z = a `par` b `seq` a+b
where
a = f 3
b = g 5
main = do
print z
当我运行这个 Haskell 片段时,它只加载了 1 个 CPU。两者f
和g
都是无意义的,但它不应该在可用时加载两个 CPU 吗?编译为ghc -O2 snippet.hs
.
f x = 1 + (f $! x)
g x = 5 + (g $! x)
z = a `par` b `seq` a+b
where
a = f 3
b = g 5
main = do
print z