
20 Aug
2006
20 Aug
'06
9:43 a.m.
Hello Brian, Sunday, August 20, 2006, 5:15:41 PM, you wrote:
data R = R {_xRef :: !(IORef Int)}
foo :: Int -> R -> IO () foo i R{_xRef = xRef} = writeIORef xRef i
is the above more efficient than:
foo i r = writeIORef (_xRef r) i
i think that first _may_ be more efficient because of strictness analysis. btw, if you want beter efficiency, you may use unboxed references (http://haskell.org/haskellwiki/Library/ArrayRef) -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com