How the IOMonad works from an OO perspective