
22 Jun
2012
22 Jun
'12
11:43 a.m.
On Fri, Jun 22, 2012 at 5:30 PM, Captain Freako
12 main = do 13 let theValue = 1 14 print theValue 15 theValueRef <- newIORef theValue 16 bump theValueRef 17 return theValue
theValue is a plain old immutable Haskell variable. "newIORef" creates an IORef whose initial value is equal to the argument; it doesn't create a pointer to the value or something like that. Change "return theValue" to "readIORef theValueRef" to extract the changed value in the IORef. --Max