redbneb's answer is almost right, except that for Monads the two time intervals are mixed, which is their essence;
Haskell’s calculation takes place after the outside world has provided some inputs, say, in the previous calculation step; build the next recipe and frasl; "computation descriptions", which are then run in turn. Otherwise, it would not be a Monad, but an application that builds its recipes and frasl; descriptions of pre-known components.
And at the very bottom of the Functor itself there are already two timelines (what is its essence): IO a value describes the "outside world" & frasl; future IO-computing, producing "inside" and frasl; net result a .
Consider:
[fx | x <- xs] f <$> xs Functor [r | x<-xs,r<-[fx]] [yx | y <- f, x <- xs] f <*> xs Applicative [r | y<-f,x<-xs,r<-[yx]] [r | x <- xs, r <- fx] f =<< xs Monad [r | x<-xs,r<- fx ]
(written using monads). Of course, the Functor (Applicative / Monad / ...) can also be clean; there are still two time frames & frasl; "worlds" there.
A few specific examples:
~> [x*2 | x<-[10,100]] ~> [r | x<-[10,100], r <- [x*2]] -- non-monadic [20,200] -- (*2) <$> [10,100] ~> [x*y | x<-[10,100], y <- [2,3]] ~> [r | x<-[10,100], y <- [2,3], r <- [x*y]] -- non-monadic [20,30,200,300] -- (*) <$> [10,100] <*> [2,3] ~> [r | x<-[10,100], y <- [2,3], r <- replicate 2 (x*y) ] ~> [r | x<-[10,100], y <- [2,3], r <- [x*y, x*y]] -- still non-monadic: ~> (\ab c-> a*b) <$> [10,100] <*> [2,3] <*> [(),()] -- it applicative! [20,20,30,30,200,200,300,300] ~> [r | x<-[10,100], y <- [2,3], r <- [x*y, x+y]] -- and even this ~> (\ab c-> c (a*b,a+b)) <$> [10,100] <*> [2,3] <*> [fst,snd] -- as well ~> (\ab c-> cab) <$> [10,100] <*> [2,3] <*> [(*),(+)] [20,12,30,13,200,102,300,103] ~> [r | x<-[10,100], y <- [2,3], r <- replicate y (x*y) ] -- only this is _essentially_ ~> [10,100] >>= \x-> [2,3] >>= \y -> replicate y (x*y) -- monadic !!!! [20,20,30,30,30,200,200,300,300,300]
Phased-monadic calculations are built from steps that cannot be built before the combined calculation time, because which recipe to build is determined by the value obtained from the previously calculated cost-value created by the calculation recipe when it is actually executed.
The following image may also display backlight :
