Restricting a monad to a type class

前端 未结 3 1926
醉梦人生
醉梦人生 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:24

    It appears that I ran into a well-known problem in Haskell. I found many workarounds by googling for "restricted monads". This solutions seems to be the least disruptive. Still, for my purposes, it seems overkill. I think I'll keep the Distribution monad general, and simplify a support via a restricted function, as suggested by Revolucent.

提交回复
热议问题