3 ms·
And most of the time it DOES warn you, google "haskell" + "If you enjoy sharing an address space with a malevolent agent of chaos" to find why unsafeCoerce and
by dontchooseanick 8y ago
And most of the time it DOES warn you, google "haskell" + "If you enjoy sharing an address space with a malevolent agent of chaos" to find why unsafeCoerce and unsafePerformIO are only for FFI writers who know-what-they-do
- gizmo686 8y agoIn fairness, that comment refers to using the function accursedUnutterablePerformIO The comment for accursedUnutterablePerformIO: This "function" has a superficial similarity to 'unsafePerformIO' but it is in fact a malevolent agent of chaos. It unpicks the seams of reality (and the 'IO' monad) so that the normal rules no longer apply. It lulls you into thinking it is reasonable, but when you are not looking it stabs you in the back and aliases all of your mutable buffers. The carcass of many a seasoned Haskell programmer lie strewn at its feet. Witness the trail of destruction: https://github.com/haskell/bytestring/commit/71c4b438c675aa360c79d79acc9a491e7bbc26e7 https://github.com/haskell/bytestring/commit/71c4b438c675aa3... https://github.com/haskell/bytestring/commit/210c656390ae617d9ee3b8bcff5c88dd17cef8da https://github.com/haskell/bytestring/commit/210c656390ae617... https://ghc.haskell.org/trac/ghc/ticket/3486 https://ghc.haskell.org/trac/ghc/ticket/3486 https://ghc.haskell.org/trac/ghc/ticket/3487 https://ghc.haskell.org/trac/ghc/ticket/3487 https://ghc.haskell.org/trac/ghc/ticket/7270 https://ghc.haskell.org/trac/ghc/ticket/7270 Do not talk about "safe"! You do not know what is safe! Yield not to its blasphemous call! Flee traveller! Flee or you will be corrupted and devoured! https://hackage.haskell.org/package/bytestring-0.10.8.1/docs/src/Data-ByteString-Internal.html#accursedUnutterablePerformIO https://hackage.haskell.org/package/bytestring-0.10.8.1/docs... EDIT: For anyone confused, accursedUnutterablePerformIO is the new name for inlinePerformIO