Context:
do state1 <- act state
dispatch $! state1
What $!
does ?
E.g. why it's not just dispatch state1
here?
$!
is strict application, the difference from dispatch state1
is that state1
is guaranteed to be evaluated and not just kept as a lazy thunk. It's defined as
f $! x = x `seq` f x
Forcing evaluation in this way can be important for efficiency issues, such as preventing memory leaks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With