hello! please forgive me if there is an obvious reference i haven’t yet found, but though my experience learning haskell has been very productive (i implemented do notation and some common monads in julia), i still have a few nagging questions about mutability and side-effects, specifically IO, and i would appreciate any help!
with mutability, i must have several concepts confused, but in c, for example, i have access to a mutation hierarchy, with some helpful syntax - primitive types are mutable → there are mutable arrays of mutable types → more elaborate mutable data structures can be constructed eg hash maps.
i have been told that in haskell, IORef provides mutability, and i have done some exercises with IORef and Array, and of course the mutability is hidden, which is good. how do i understand the ‘source’ of the mutability in haskell? is everything written in haskell? how do i know if something is mutable? how do i ‘extend’ mutability?
regarding IO, i think my question is similar - i understand that eg do notation is sugar for constructing a nested function with repeated monad/function applications - but what does the haskell runtime do when it runs the program? what is haskell giving my function that allows it access to 1) file pointers 2) stdin/out 3) sockets? how much of THIS is written in haskell?
with python i have an understanding that all the ‘interesting’ code is written in c, and that model makes sense to me. haskell, being a much more sophisticated enterprise, doesn’t seem to have this quality, but by virtue if it being functional, i am naturally left to wonder how it actually interacts with the outside world.