Restricting a monad to a type class

前端 未结 3 1917
醉梦人生
醉梦人生 2020-12-09 18:18

In Haskell, is there a way to restrict a monad M a so that a satisfy a type class constraint?

I am translating the probabilistic modeling e

3条回答
  •  遥遥无期
    2020-12-09 18:29

    Check out Martin Erwig's library, PFP:

    The PFP library is a collection of modules for Haskell that facilitates probabilistic functional programming, that is, programming with stochastic values. The probabilistic functional programming approach is based on a data type for representing distributions. A distribution represent the outcome of a probabilistic event as a collection of all possible values, tagged with their likelihood.

提交回复
热议问题