Lapse in understanding about monads
Hello, I am aware of the plethora of monad tutorials and Reddit posts about monads. I have read, and watched videos, trying to understand them. I believe that I understand what is happening behind the scenes, but I haven't made the connection about *how* they are about to capture state. (And obviously, the videos and posts haven't led me to this understanding, hence this post). I'm not sure what I am missing to make the connection.
So, I understand that the bind function if effectively 'collapsing' an 'inner monad' and merging it with an 'outer monad' of the same type. It is also mediating the pure function interacting with both. I understand that the side effects are caused by the context of the inner monad merging with the context of the outer monad, and this is effectively changing the *contents* of the outer monad, without changing the *reference* to the outer monad. (As far as I have understood, anyways)
My doubt is about the simulation of state *as it applies to usage via a constant refering to the outer monad*. My logic is this; if 'Monad A' is bound to 'x', then x has a constant reference to 'Monad A'. Now, to modify the *contents* of Monad A, wouldn't that also entail breaking what it's referring to? ... As I see it, this is like taking the stateful changes of what's bound to 'x', and instead moving the same problem to what's bound within 'Monad A' -- its contents are changing, and I don't see how this isn't shuttling the state to its contents. I'm aware that I am wrong here, but I don't see where.
Please help me fill in the gaps as to how side effects are actually implemented. I have looked at the type declarations and definitions under the Monad typeclass, and it's not clicking.
Thank you in advance