Why do some interfaces of binding libraries have no IO monad?

I’ve seen a lot of binding libraries. I have found that there is no IO monad in their interfaces(such as Eigen).
How did they achieve it?
I have written some binding libraries, which are originally C language libraries.All the interfaces have IO monad.
Thanks for answering.

1 Like

With the Haskell C FFI you have to give the signature of each imported function yourself, so you can just choose to use IO or not.

Additionally, binding writers might expose a higher level pure interface on top of low level IO functions. In that case they can use unsafePerformIO if they are sure that the interface is really pure.

4 Likes

:slightly_smiling_face: I see,Thanks a lot!