title: Processing IO values in haskell
body: <p>I'm writing a small program with IO actions in Haskell
  here is</p>
  
  <pre><code>module StackQuestion where
  
  import Data.Map (Map, insert, fromList)
  
  type Name = String
  type Value = String
  
  readValue :: Name -&gt; IO String
  readValue name = do     putStrLn name
                          value &lt;- getLine
                          return value
  
  addPair :: Name -&gt; Value -&gt; Map Name Value -&gt; Map Name Value
  addPair = insert
  
  names = map show [1..5]
  values = map (\char -&gt; [char]) ['a'..'d']
  initialMap = fromList (zip names values)
  </code></pre>
  
  <p>As you can see I have some initial map with values, and function which adds a pair to map, functions which reads a value.</p>
  
  <p>How I can get a clear <code>String</code> value from <code>readValue</code> and pass it to another function ?</p>
  
  <p>Or should I change <code>type Value = String</code> to <code>type Value = IO String</code> and use map <code>Map String (IO String)</code> ?</p>
  
  <p>And if I have <code>Map String (IO String)</code> how can i process this map, how I can get any value depening on data in <code>IO</code> containter (maybe some function <code>func :: (a-&gt;b) -&gt; IO a -&gt; b</code>)
  For instance is there any way to compare <code>IO String</code> with the <em>clear</em> <code>String</code> ?</p>
  
  <p>If I have function <code>func</code> I would have written</p>
  
  <pre><code>map :: Map String (IO String)
  ...
  func (==) (map ! "key")
  </code></pre>
  
  <p>What is the strategy of working with <code>IO</code> values ?</p>