4 ms·
Except this isn’t true. I can embed arbitrary side effects in any line of Haskell code with something like foo :: Int -> String foo x = seq
by fiddlerwoaroof 5y ago
Except this isn’t true. I can embed arbitrary side effects in any line of Haskell code with something like
foo :: Int -> String
foo x = seq
(unsafePerformIO $
println “pwned”)
(show x)
- kqr 5y agoYes, we know unsafePerformIO exists, but nobody really uses it, it's clearly "unsafe", you can have your build chain scream at its occurrence, and... fast and loose reasoning is morally correct[1]. [1]: https://dl.acm.org/doi/10.1145/1111320.1111056 https://dl.acm.org/doi/10.1145/1111320.1111056
- chriswarbo 5y agoFYI this sort of 'backdoor' can be forbidden using the "safe haskell" extension in GHC: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/exts/safe_haskell.html https://downloads.haskell.org/~ghc/latest/docs/html/users_gu...