Skip to content
Snippets Groups Projects
Commit e9ff8d60 authored by Cheng Shao's avatar Cheng Shao Committed by Andrew Martin
Browse files

Update Control/Monad/Primitive.hs

parent b7207940
No related branches found
No related tags found
No related merge requests found
......@@ -339,10 +339,11 @@ touch x = unsafePrimToPrim
$ (primitive (\s -> case touch# x s of { s' -> (# s', () #) }) :: IO ())
keepAlive :: PrimBase m => a -> (a -> m r) -> m r
{-# INLINE keepAlive #-}
#if defined(HAVE_KEEPALIVE)
{-# INLINE keepAlive #-}
keepAlive x k = unsafeIOToPrim $ primitive $ \s0 -> keepAlive# x s0 $ internal $ unsafePrimToIO $ k x
#else
{-# NOINLINE keepAlive #-}
keepAlive x k = k x <* touch x
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment