[Haskell-cafe] Issues with IO and FFIs
bertram.felgenhauer at googlemail.com
Wed Apr 22 06:09:36 EDT 2009
Jon Harrop wrote:
> Does anyone have any comments on the following criticism of some
> difficulties with FFI, including IO, in Haskell:
That post conflates two separate questions.
1) binding to foreign libraries that export functions that are
semantically pure, but can't be imported as pure functions, for
example because they use pointers.
unsafePerformIO was added in the FFI spec for exactly this purpose,
as you can see for yourself here:
2) global variables. This has been a topic of long and heated debates,
with no clear winner. I don't think another debate will be fruitful.
> In particular, is it not always possible to write IO libraries safely in
Flame bait? Yes, it is not always possible, because some interfaces are
inherently unsafe, putting the burden of using them safely on the user.
unsafePerformIO itself is a prime example for this.
More information about the Haskell-Cafe