これは実行します:
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