unsafePerformIO and unsafeInterleaveIO
Manuel M. T. Chakravarty
chak at cse.unsw.edu.au
Tue Mar 20 21:41:53 EST 2001
"Simon Marlow" <simonmar at microsoft.com> wrote,
> > qrczak at knm.org.pl (Marcin 'Qrczak' Kowalczyk) wrote,
> > > Mon, 19 Mar 2001 11:04:43 -0700, Alastair Reid
> > <reid at cs.utah.edu> pisze:
> > >
> > > > > Should these functions be available through the standard FFI?
> > > > > IMHO they should.
> > I guess, you could a (maybe inefficient) version of
> > unsafePerformIO using the FFI functionality anyway. This
> > gives us a default implementation, so I thing, we should
> > include it. I am not so sure about unsafeInterleaveIO.
> I'm not sure about including these functions in Foreign. Their location
> should be standardised, sure: but that's something to be discussed as
> part of the new library proposal. I don't feel they belong in Foreign.
I guess, the point is that FFI routines often need
unsafePerformIO - for example, to implement the marshalling
for pure external functions. Without a standard way to get
at unsafePerformIO, such code would still rely on
non-standard features, which goers against the aim of
standardising the rest of the FFI.
More information about the FFI