[Haskell-cafe] runST $ unsafeIOToST $ ioWhatever
Henning Thielemann
lemming at henning-thielemann.de
Sun Apr 14 20:16:57 UTC 2024
On Sun, 14 Apr 2024, Folsk Pratima wrote:
> tryIOString :: CSize -> IO (Maybe String)
> tryIOString size =
> allocaBytes (fromIntegral size) $ \ptr -> do
> zeroptr <- memSet ptr 0 (fromIntegral size)
You may instead do
withArray (replicate (fromIntegral size) 0) $ \ptr -> do
st <- c_strerror_r (fromIntegral errnum) ptr size
...
More information about the Haskell-Cafe
mailing list