Unsafe Haskell (2015)
seas.upenn.edu
seas.upenn.edu
Of course, if they or you are using these escape hatches, and it's not correct -- and it blows up -- you've only yourself to blame for subverting the compiler.
For instance, Coq code can be extracted to OCaml code. OCaml type system is less powerful than Coq's, so Coq needs to cheat, and the emitted code is full of "unsafe" features. But the program was typechecked with Coq's type system, and is thus perfectly safe.
Of course, the goal of the language designer is to minimize its usage. That's something the Rust people understood very well, and the unsafe blocks are an extremely good solution to this problem.
E.g. FFI becomes horrendously impractical without something of this kind.
https://dbp.io/pubs/2017/linking-types-snapl.pdf
If the component is externally type-checked, the integration can be type checked against the language including it. They're also working on verifying compilers that do that:
https://dbp.io/essays/2018-04-19-how-to-prove-a-compiler-ful...
Previously, others made the assembly languages themselves type-safe. Example:
https://www.cs.cornell.edu/talc/papers/talx86-wcsss.pdf
We might eventually be able to drop a caveat or three when talking about where type/memory safety ends. Cool stuff, eh?
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/71c4b438c675aa3...
https://github.com/haskell/bytestring/commit/210c656390ae617...
https://ghc.haskell.org/trac/ghc/ticket/3486
https://ghc.haskell.org/trac/ghc/ticket/3487
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...
EDIT: For anyone confused, accursedUnutterablePerformIO is the new name for inlinePerformIO
https://downloads.haskell.org/~ghc/7.8.4/docs/html/users_gui...