sum <- newIORef 0
i <- newIORef 1
let go = do i' <- readIORef i
            when (i'<n) $ do
                modifyIORef sum (+i')
                modifyIORef i   (+1)
                go
result <- readIORef sum



why in the world would you write a  summation function like that?