-
-
Save lucamolteni/07783ad8e1c2eb5b69bbc26635d726f8 to your computer and use it in GitHub Desktop.
Haskell Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Assign where | |
import Data.IORef | |
mkSummer :: IO (Int -> Int -> IO Int) | |
mkSummer = do | |
ref <- newIORef 0 | |
return $ \x y -> do | |
val <- readIORef ref | |
let ret = val + x + y | |
writeIORef ref ret | |
return ret |
Author
lucamolteni
commented
Oct 7, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment