Hoogle Search

Within LTS Haskell 24.67 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. currentCallStack :: IO [String]

    base GHC.Exts

    Returns a [String] representing the current call stack. This can be useful for debugging. The implementation uses the call-stack simulation maintained by the profiler, so it only works if the program was compiled with -prof and contains suitable SCC annotations (e.g. by using -fprof-auto). Otherwise, the list returned is likely to be empty or uninformative.

  2. reallyUnsafePtrEquality :: a -> a -> Int#

    base GHC.Exts

    Compare the underlying pointers of two values for equality. Returns 1 if the pointers are equal and 0 otherwise. The two values must be of the same type, of kind Type. See also reallyUnsafePtrEquality#, which doesn't have such restrictions.

  3. resizeSmallMutableArray# :: SmallMutableArray# s a -> Int# -> a -> State# s -> (# State# s, SmallMutableArray# s a #)

    base GHC.Exts

    Resize a mutable array to new specified size. The returned SmallMutableArray# is either the original SmallMutableArray# resized in-place or, if not possible, a newly allocated SmallMutableArray# with the original content copied over. To avoid undefined behaviour, the original SmallMutableArray# shall not be accessed anymore after a resizeSmallMutableArray# has been performed. Moreover, no reference to the old one should be kept in order to allow garbage collection of the original SmallMutableArray# in case a new SmallMutableArray# had to be allocated.

  4. setThreadAllocationCounter# :: Int64# -> State# RealWorld -> State# RealWorld

    base GHC.Exts

    Sets the allocation counter for the current thread to the given value.

  5. MallocPtr :: MutableByteArray# RealWorld -> !IORef Finalizers -> ForeignPtrContents

    base GHC.ForeignPtr

    The pointer refers to a byte array. The MutableByteArray# field means that the MutableByteArray# is reachable (by GC) whenever the ForeignPtr is reachable. When the ForeignPtr becomes unreachable, the runtime's normal GC recovers the memory backing it. Here, the finalizer function intended to be used to free() any ancillary *unmanaged* memory pointed to by the MutableByteArray#. See the zlib library for an example of this use.

    1. Invariant: The Addr# in the parent ForeignPtr is an interior pointer into this MutableByteArray#.
    2. Invariant: The MutableByteArray# is pinned, so the Addr# does not get invalidated by the GC moving the byte array.
    3. Invariant: A MutableByteArray# must not be associated with more than one set of finalizers. For example, this is sound:
    incrGood :: ForeignPtr Word8 -> ForeignPtr Word8
    incrGood (ForeignPtr p (MallocPtr m f)) = ForeignPtr (plusPtr p 1) (MallocPtr m f)
    
    But this is unsound:
    incrBad :: ForeignPtr Word8 -> IO (ForeignPtr Word8)
    incrBad (ForeignPtr p (MallocPtr m _)) = do
    f <- newIORef NoFinalizers
    pure (ForeignPtr p (MallocPtr m f))
    

  6. mallocForeignPtr :: Storable a => IO (ForeignPtr a)

    base GHC.ForeignPtr

    Allocate some memory and return a ForeignPtr to it. The memory will be released automatically when the ForeignPtr is discarded. mallocForeignPtr is equivalent to

    do { p <- malloc; newForeignPtr finalizerFree p }
    
    although it may be implemented differently internally: you may not assume that the memory returned by mallocForeignPtr has been allocated with malloc. GHC notes: mallocForeignPtr has a heavily optimised implementation in GHC. It uses pinned memory in the garbage collected heap, so the ForeignPtr does not require a finalizer to free the memory. Use of mallocForeignPtr and associated functions is strongly recommended in preference to newForeignPtr with a finalizer.

  7. mallocForeignPtrAlignedBytes :: Int -> Int -> IO (ForeignPtr a)

    base GHC.ForeignPtr

    This function is similar to mallocForeignPtrBytes, except that the size and alignment of the memory required is given explicitly as numbers of bytes.

  8. mallocForeignPtrBytes :: Int -> IO (ForeignPtr a)

    base GHC.ForeignPtr

    This function is similar to mallocForeignPtr, except that the size of the memory required is given explicitly as a number of bytes.

  9. mallocPlainForeignPtr :: Storable a => IO (ForeignPtr a)

    base GHC.ForeignPtr

    Allocate some memory and return a ForeignPtr to it. The memory will be released automatically when the ForeignPtr is discarded. GHC notes: mallocPlainForeignPtr has a heavily optimised implementation in GHC. It uses pinned memory in the garbage collected heap, as for mallocForeignPtr. Unlike mallocForeignPtr, a ForeignPtr created with mallocPlainForeignPtr carries no finalizers. It is not possible to add a finalizer to a ForeignPtr created with mallocPlainForeignPtr. This is useful for ForeignPtrs that will live only inside Haskell (such as those created for packed strings). Attempts to add a finalizer to a ForeignPtr created this way, or to finalize such a pointer, will throw an exception.

  10. mallocPlainForeignPtrAlignedBytes :: Int -> Int -> IO (ForeignPtr a)

    base GHC.ForeignPtr

    This function is similar to mallocForeignPtrAlignedBytes, except that the internally an optimised ForeignPtr representation with no finalizer is used. Attempts to add a finalizer will cause an exception to be thrown.

Page 187 of many | Previous | Next