Re: [Haskell-cafe] Haskell trickery

2005-12-20 Thread Donald Bruce Stewart
joelr1: > Folks, > > How is one to interpret the following? I'm particularly interested in > the "IO $ \ s -> " notatoin as I have never seen that before. > > allocaBytes :: Int -> (Ptr a -> IO b) -> IO b > allocaBytes (I# size) action = IO $ \ s -> > case newPinnedByteArray# size s o

[Haskell-cafe] Haskell trickery

2005-12-20 Thread Joel Reymont
Folks, How is one to interpret the following? I'm particularly interested in the "IO $ \ s -> " notatoin as I have never seen that before. allocaBytes :: Int -> (Ptr a -> IO b) -> IO b allocaBytes (I# size) action = IO $ \ s -> case newPinnedByteArray# size s of { (# s, mbarr# #) ->