3 ms·
I was referring more to Haskell's lack of side effects. I don't think you can do this in modules.
by TazeTSchnitzel 13y ago
I was referring more to Haskell's lack of side effects. I don't think you can do this in modules.
- jerf 13y agoYou can, with unsafePerformIO. Unlike many instances where we can just wave away unsafePerformIO and declare it's an exception that you'll probably never encounter unless you ask for it, this is one instance you may encounter "in the wild" that may not be entirely safe, or may introduce a global scope where you weren't necessarily expecting one. In particular, this usually takes the form of creating a Reference of some kind at initialization time (IORef, STM TVar, etc).