作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有这种类型,基本上是 Kleisli 箭头:
{-# language DeriveFunctor #-}
data Plan m i o = Plan (i -> m o) deriving Functor
instance (Monad m) => Applicative (Plan m i) where
pure x = Plan (\_ -> pure x)
Plan f <*> Plan x = Plan (\i -> f i <*> x i)
Applicative
例如,我打开
ApplicativeDo
并尝试使用 do-notation 构建一个值:
{-# language ApplicativeDo #-}
myplan :: Plan IO () ()
myplan = do
pure ()
pure ()
No instance for (Monad (Plan IO ())) arising from a do statement
最佳答案
搜索 ApplicativeDo
后相关门票在GHC Trac ,看来这是一个已知问题:
do
_ <- pure ()
pure ()
关于haskell - ApplicativeDo 不使用测序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41210599/
检查 Kleisli 定义, in Cats, and Functional and Reactive Domain Modelling 但是我还不能理解它的用处。如果我们谈论组合 Monadic 函
我是一名优秀的程序员,十分优秀!