TITLE: Haskell Update Record Trick
module Main where
import AronModule
import Data.IORef
import Control.Lens hiding (pre, re)
data MyRec = MyRec {a_ :: Int, b_ :: Int} deriving (Eq, Show)
main = do
let r = MyRec {a_ = 3, b_ = 4}
refR <- newIORef r
modifyIORef refR (\s -> let s' = s{a_ = 100} in s'{a_ = a_ s' + 100})
rt <- readIORef refR
print $ show rt