Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lolcathost% ghci
- GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
- > import Data.IORef
- import Data.IORef
- > x <- newIORef 5
- > let f y = (+) <$> readIORef x <*> pure y
- > f 10
- 15
- > writeIORef x 0
- > f 10
- 10
- >
- Leaving GHCi.
- lolcathost% poly
- Poly/ML 5.6 Release
- > val x = ref 5;
- val x = ref 5: int ref
- > fun f y = !x + y;
- val f = fn: int -> int
- > f 10;
- val it = 15: int
- > x := 0;
- val it = (): unit
- > f 10;
- val it = 10: int
- lolcathost%
Advertisement
Add Comment
Please, Sign In to add comment