27.12.2013 Views

Wearing the hair shirt Wearing the hair shirt - Microsoft Research

Wearing the hair shirt Wearing the hair shirt - Microsoft Research

Wearing the hair shirt Wearing the hair shirt - Microsoft Research

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The IO monad<br />

<br />

<br />

The IO monad allows controlled introduction of<br />

o<strong>the</strong>r effect-ful language features (not just I/O)<br />

State<br />

newRef :: IO (IORef a)<br />

read :: IORef s a -> IO a<br />

write :: IORef s a -> a -> IO ()<br />

Concurrency<br />

fork :: IO a -> IO ThreadId<br />

newMVar :: IO (MVar a)<br />

takeMVar :: MVar a -> IO a<br />

putMVar :: MVar a -> a -> IO ()

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!