←back to thread

498 points azhenley | 1 comments | | HN request time: 0.247s | source
Show context
y0ned4 ◴[] No.45769960[source]
When I started programming in Haskell, where all variables are immutable, I felt like I was in a straitjacket

Then, suddenly, the enlightenment

replies(5): >>45770377 #>>45770438 #>>45770896 #>>45771052 #>>45771863 #
criddell ◴[] No.45771052[source]
How does Haskell deal with things like memory-mapped I/O or signal handlers where the value of a variable can be changed by factors outside of the programmer's control?
replies(2): >>45771504 #>>45771883 #
1. chuckadams ◴[] No.45771883[source]
IORefs usually, which can only be manipulated within the IO monad, so they tend to only get used at the top level and passed down to pure functions as parameters.