Udo Stenzel wrote:
| toLazyByteString :: Builder - L.ByteString
| toLazyByteString m = S.LPS $ inlinePerformIO $ do
| buf - newBuffer defaultSize
| return (runBuilder (m `append` flush) (const []) buf)
Why is this safe? Considering the GHC implementation of IO, isn't there
a real
Roberto Zunino wrote:
Floating out (newBuffer defaultSize) as in
| foo = newBuffer defaultSize
|
| toLazyByteString m = S.LPS $ inlinePerformIO $ do
| buf - foo
| return (runBuilder (m `append` flush) (const []) buf)
would still be safe, AFAICS. Floating out buf instead should
On Thu, 2007-06-14 at 22:50 -0700, Stefan O'Rear wrote:
| unsafeLiftIO :: (Buffer - IO Buffer) - Builder
| unsafeLiftIO f = Builder $ \ k buf - inlinePerformIO $ do
| buf' - f buf
| return (k buf')
which might be safe, since 'f buf' cannot float out of the lambda which
Greetings,
I was trying to understand the magic inside Data.Binary, and found two
somewhat suspicious uses of inlinePerformIO, which imho has a far too
innocuous name:
| toLazyByteString :: Builder - L.ByteString
| toLazyByteString m = S.LPS $ inlinePerformIO $ do
| buf - newBuffer
On Fri, 2007-06-15 at 01:03 +0200, Udo Stenzel wrote:
Greetings,
I was trying to understand the magic inside Data.Binary, and found two
somewhat suspicious uses of inlinePerformIO, which imho has a far too
innocuous name:
It's not really supposed to be a public api. We've decided to rename
On Fri, Jun 15, 2007 at 06:46:11AM +0100, Duncan Coutts wrote:
On Fri, 2007-06-15 at 01:03 +0200, Udo Stenzel wrote:
The other occurence is:
| unsafeLiftIO :: (Buffer - IO Buffer) - Builder
| unsafeLiftIO f = Builder $ \ k buf - inlinePerformIO $ do
| buf' - f buf
| return