Haskell provides a convenient function forever that repeats a monadic effect indefinitely. It can be defined as follows:
forever :: Monad m => m a -> m b
forever ma = ma >> forever ma
However, in the standard library the function is defined differently:
forever :: Monad m => m a -> m b
forever a = let a' = a *> a' in a'
The let binding is used to force "explicit sharing here, as it prevents a space leak regardless of optimizations" (from the comment on implementation).
Can you explain why the first definition potentially has space leaks?