On Fri, Jun 22, 2012 at 5:30 PM, Captain Freako <capn.fre...@gmail.com> wrote:
>  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

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to