<commit_before>{-# OPTIONS_JHC -fffi #-}
module Foreign.StablePtr(
    StablePtr(),
    castStablePtrToPtr,
    castPtrToStablePtr,
    newStablePtr,
    deRefStablePtr,
    freeStablePtr
    ) where

import Foreign.Ptr

newtype StablePtr a = StablePtr (Ptr ())
data PlaceHolder

castPtrToStablePtr :: Ptr () -> StablePtr a
castPtrToStablePtr p = StablePtr p

castStablePtrToPtr :: StablePtr a -> Ptr ()
castStablePtrToPtr (StablePtr p) = p


freeStablePtr :: StablePtr a -> IO ()
freeStablePtr _ = return ()

newStablePtr :: a -> IO (StablePtr a)
newStablePtr x = do
    ptr <- ref_ptr (unsafeCoerce x)
    return (StablePtr ptr)
<commit_msg>Make Foreign.StablePtr not depend on Prelude<commit_after>{-# OPTIONS_JHC -N -fffi #-}
module Foreign.StablePtr(
    StablePtr(),
    castStablePtrToPtr,
    castPtrToStablePtr,
    newStablePtr,
    deRefStablePtr,
    freeStablePtr
    ) where

import Jhc.Addr
import Jhc.Basics
import Jhc.IO
import Jhc.Monad

newtype StablePtr a = StablePtr (Ptr ())
data PlaceHolder

castPtrToStablePtr :: Ptr () -> StablePtr a
castPtrToStablePtr p = StablePtr p

castStablePtrToPtr :: StablePtr a -> Ptr ()
castStablePtrToPtr (StablePtr p) = p


freeStablePtr :: StablePtr a -> IO ()
freeStablePtr _ = return ()

newStablePtr :: a -> IO (StablePtr a)
newStablePtr x = do
    ptr <- ref_ptr (unsafeCoerce x)
    return (StablePtr ptr)

{'fraction_non_alphanumeric': 0.09736456808199122, 'fraction_numerical': 0.0, 'mean_word_length': 3.813380281690141, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6412149', 'n_tokens_mistral': 517, 'n_tokens_neox': 506, 'n_words': 128}