functional programming - Purescript applicative does not execute -
this executes:
main =    ctx <- getcanvaselementbyid "stage" >>= getcontext2d   bs  <- initbranches   tick 0 ctx bs but not:
main = tick 0 <$> (getcanvaselementbyid "stage" >>= getcontext2d)               <*> initbranches however both compile, , understanding both mean same basic thing. why case? can use applicative syntax here (its more understandable imho)
this works
main =   <- (tick 0) <$> (getcanvaselementbyid "stage" >>= getcontext2d) <*> initbranches    b <-   fprint b 
main = join $ tick 0 <$> (getcanvaselementbyid "stage" >>= getcontext2d)                       <*> initbranches  the applicative creates nested eff, join resolves easily
Comments
Post a Comment