繁体   English   中英

Purescript应用程序不执行

[英]Purescript applicative does not execute

执行:

main = do 
  ctx <- getCanvasElementById "stage" >>= getContext2D
  bs  <- initBranches
  tick 0 ctx bs

但这不是:

main = tick 0 <$> (getCanvasElementById "stage" >>= getContext2D)
              <*> initBranches

但是,两者都是可编译的,据我所知,两者都具有相同的基本含义。 为什么会这样呢? 我可以在这里使用适用的语法吗(恕我直言,恕我直言)


这也有效

main = do
  a <- (tick 0) <$> (getCanvasElementById "stage" >>= getContext2D) <*> initBranches 
  b <- a
  fprint b
main = join $ tick 0 <$> (getCanvasElementById "stage" >>= getContext2D) 
                     <*> initBranches 

应用程序创建一个嵌套的Eff,join可以轻松解决此问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM