Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Published almost entirely for benchmarks, comparing to stdlib! Should have little direct interest to Harfbuzz callers, & I'm not promising a stable API. This is here because, as it turns out, Harfbuzz can return a lot of output!
Synopsis
- clonePtr :: Storable a => Ptr a -> Int -> IO (ForeignPtr a)
- peekLazy :: Storable a => ForeignPtr a -> Int -> [a]
- peekEager :: Storable a => [a] -> Int -> Ptr a -> IO [a]
- chunkSize :: Int
- iterateLazy :: Storable a => Ptr a -> Int -> IO [a]
- accursedUnutterablePerformIO :: IO a -> a
- noCache :: (a -> b) -> a -> b
Documentation
clonePtr :: Storable a => Ptr a -> Int -> IO (ForeignPtr a) Source #
Clone the given array so it can be freed without the losing access to the data.
Uses memcpy
so it gets very heavily optimized by the OS.
peekLazy :: Storable a => ForeignPtr a -> Int -> [a] Source #
Iterate over an array in a ForeignPtr, no matter how small or large it is.
peekEager :: Storable a => [a] -> Int -> Ptr a -> IO [a] Source #
Variation of peekArray, taking a tail to append to the decoded list.
iterateLazy :: Storable a => Ptr a -> Int -> IO [a] Source #
Convert an array from C code into a Haskell list, performant no matter how small or large it is.
accursedUnutterablePerformIO :: IO a -> a Source #
This "function" has a superficial similarity to unsafePerformIO
but
it is in fact a malevolent agent of chaos. It unpicks the seams of reality
(and the IO
monad) so that the normal rules no longer apply. It lulls you
into thinking it is reasonable, but when you are not looking it stabs you
in the back and aliases all of your mutable buffers. The carcass of many a
seasoned Haskell programmer lie strewn at its feet.
Witness the trail of destruction:
- https://github.com/haskell/bytestring/commit/71c4b438c675aa360c79d79acc9a491e7bbc26e7
- https://github.com/haskell/bytestring/commit/210c656390ae617d9ee3b8bcff5c88dd17cef8da
- https://github.com/haskell/aeson/commit/720b857e2e0acf2edc4f5512f2b217a89449a89d
- https://ghc.haskell.org/trac/ghc/ticket/3486
- https://ghc.haskell.org/trac/ghc/ticket/3487
- https://ghc.haskell.org/trac/ghc/ticket/7270
- https://gitlab.haskell.org/ghc/ghc/-/issues/22204
Do not talk about "safe"! You do not know what is safe!
Yield not to its blasphemous call! Flee traveller! Flee or you will be corrupted and devoured!
noCache :: (a -> b) -> a -> b Source #
Harfbuzz produces ~40x as much output data as its input data. In many applications that input data would be a large fraction of its heap. As such, unless callers are processing these results, it is usually more efficient for Haskell to recompute the glyphs than to store them.
This synonym of oneShot
is used to instruct Haskell of this fact.