4 ms·
Let's just hope there is a "load and execute random code from the network" effect that you could disable. NetworkAccess Effect wouldn't be that strange for a l
by stonemetal12 5y ago
Let's just hope there is a "load and execute random code from the network" effect that you could disable.
NetworkAccess Effect wouldn't be that strange for a logging system that supports multiple networked log managers like syslog.
- Quekid5 5y agoThe point isn't so much that you can disable effects. It's that you literally have no effects/capabilities unless specifically granted. That said, I'm a bit skeptical that Haskell would have prevented this particular issue in practice. The logging monad would just likely just have been called a LoggingM (in MTL style) and most users would have been oblivious as to exactly what it was doing... and as you say: Logging to a remote system needs the network. I guess what could have saved a Haskell program here is that there's no such thing as "download code and execute it with the same privileges as you" with being very explicit about that. (E.g. calling 'system' or whatever)
- Akronymus 5y agoYou could split it up into 2 functions I guess. A pure one that creates the log entry, then an IO one that actually saves it.
- Quekid5 5y agoYes, but if the IO one does <shenanigans> then you're as well off. Which is... not very. EDIT: Just to say: I don't mean to be flippant.
- Akronymus 5y agoOh its fine. And i meanr it more in that one part is literally just passing the data along, while the other part generates the data with being fed whatever is needed for it to. so, if yoj want to just log a literal string yoj wouldnt provide any additional functionality to the generator. if you want it to expand strings, then you provide a function for that. and so on
- thesz 5y agoAccesses can be distinguished too - read and write accesses are different. You can see this in [1] - there are Reader and Writer monads, where Reader is used for effectively unchangeable parameter to a monadic context (for example, socket) and Writer is used, among other things, for logging!