Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I was referring more to Haskell's lack of side effects. I don't think you can do this in modules.


You 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).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: