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?
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to