Numeric.Probability.Monad没有从概率包导出,因此示例不起作用?

时间:2013-02-03 20:01:31

标签: haskell probability cabal ghci

我正在玩probability包,试图了解各种示例的工作原理。许多示例导入了隐藏的Numeric.Probability.Monad,因此意味着我无法运行这些示例。

Monty Hall Example

module Numeric.Probability.Example.MontyHall where

import qualified Numeric.Probability.Distribution as Dist
import qualified Numeric.Probability.Transition as Trans
import Numeric.Probability.Simulation ((~.), )

import Numeric.Probability.Percentage
    (Dist, RDist, Trans, )

import qualified Numeric.Probability.Monad as MonadExt

如果我尝试在ghci中运行它

:load "MontyHall.hs"

MontyHall.hs:10:18:
    Could not find module `Numeric.Probability.Monad'
    it is a hidden module in the package `probability-0.2.4'
    Use -v to see a list of the files searched for.
Failed, modules loaded: none.

显然我做错了什么,因为无法运行的例子是什么。那我在这里做错了什么?

1 个答案:

答案 0 :(得分:1)

Numeric.Probability.Monad文件中使用MontyHall的唯一功能就是这个:

compose :: Monad m => [a -> m a] -> a -> m a
compose = foldl (flip (<=<)) return

它是一个简单的辅助功能,你可以自己内联。