3 ms·
> where it's known to be safe and necessary To give a valid, non-objectionable example: FFI that is known to be pure will often be wrapped with unsafePerformIO
by 15155 11y ago
> where it's known to be safe and necessary
To give a valid, non-objectionable example: FFI that is known to be pure will often be wrapped with unsafePerformIO to present a clean interface to Haskell code.
- chadaustin 11y agoIndeed. Consider https://github.com/chadaustin/buffer-builder/blob/master/src/Data/BufferBuilder.hs#L164 https://github.com/chadaustin/buffer-builder/blob/master/src... The API is pure, but it's implemented with a high-performance effectful monad, and none of the implementation details are exported. A perfect use of unsafe[Dupable]PerformIO.