{-# LANGUAGE Unsafe #-} {-# LANGUAGE NoImplicitPrelude #-} ----------------------------------------------------------------------------- -- | -- Module : Foreign.Marshal.Unsafe -- Copyright : (c) The FFI task force 2003 -- License : BSD-style (see the file libraries/base/LICENSE) -- -- Maintainer : [email protected] -- Stability : provisional -- Portability : portable -- -- Marshalling support. Unsafe API. -- ----------------------------------------------------------------------------- module Foreign.Marshal.Unsafe ( -- * Unsafe functions unsafeLocalState ) where import GHC.IO {- | Sometimes an external entity is a pure function, except that it passes arguments and/or results via pointers. The function @[email protected] permits the packaging of such entities as pure functions. The only IO operations allowed in the IO action passed to @[email protected] are (a) local allocation (@[email protected], @[email protected] and derived operations such as @[email protected] and @[email protected]), and (b) pointer operations (@[email protected] and @[email protected]) on the pointers to local storage, and (c) foreign functions whose only observable effect is to read and/or write the locally allocated memory. Passing an IO operation that does not obey these rules results in undefined behaviour. It is expected that this operation will be replaced in a future revision of Haskell. -} unsafeLocalState :: IO a -> a unsafeLocalState = unsafeDupablePerformIO