FFI, safe vs unsafe

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Wed Mar 29 09:01:17 EST 2006


On Wed, 2006-03-29 at 07:32 -0600, Taral wrote:
> On 3/29/06, Simon Marlow <simonmar at microsoft.com> wrote:
> > If we were to go down this route, we have to make reentrant the default:
> > 'unsafe' is so-called for a good reason, you should be required to write
> > 'unsafe' if you're doing something unsafe.  So I'd suggest
> >
> >   unsafe
> >   concurrent unsafe
> >   concurrent          -- the hard one
> >   {- nothing -}
> 
> Can I suggest "sef" in this? Most cases of "unsafe" are actually
> claims that the call is side-effect free.

c2hs uses the keyword "pure" for this purpose, which I rather like.

c2hs transforms:
{# call pure foo_bar #}

into a call plus a foreign import with the "unsafe" tag.

Duncan



More information about the Haskell-prime mailing list