title: Invisible type signature in Haskell
body: <p>I want to use ambiguous type <code>a</code> in function as follows, but it fails.</p>
  
  <pre><code>foo :: (Read a, Show a) =&gt; IO ()
  foo = print =&lt;&lt; (readLn :: IO a)
  </code></pre>
  
  <p>The purpose is to get different outputs regarding to the given type signature when actually called.</p>
  
  <pre><code>&gt;&gt;&gt; foo :: Double =&gt; IO ()
  34   -- user input
  34.0 -- output
  
  &gt;&gt;&gt; foo :: Int =&gt; IO ()
  34   -- user input
  34   -- output
  </code></pre>
  
  <p>How can I manage this?</p>