3 ms·
What are you basing your disagreement on? Can you explain to me in which sense "x" is evaluated before "y" in this example? {-# LANGUAGE BangPatterns #-}
by tome 7y ago
What are you basing your disagreement on? Can you explain to me in which sense "x" is evaluated before "y" in this example?
{-# LANGUAGE BangPatterns #-}
import Data.Functor.Identity
import Debug.Trace
f = let !_ = trace "Evaluating f" ()
in return 1
g x = let !_ = trace "Evaluating g" ()
in return (x + 1)
example :: Int
example = runIdentity $ do
x <- f
y <- g x
return y
> example
Evaluating g
Evaluating f
2