Re: runST $ unsafeIOToST $ ioWhatever
Henning Thielemann <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.cafe |
|---|---|
| Message-ID | <[email protected]> |
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
...
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.