title: Convert a String to a Type Constructor in Haskell
body: <p>Does anyone know if there's a function in Haskell which does something like this:</p>
  
  <pre><code>"Int" -&gt; Int
  
  "String" -&gt; String
  
  "Bool" -&gt; Bool
  </code></pre>
  
  <p>ie. it takes a string representation of a type constructor name, and converts it to the actual type constructor, both in an expression and in a pattern.</p>
  
  <p>edit:
  My overall goal is to simplify something like:</p>
  
  <pre><code>transExp (Add exp1 exp2) vars
    = transExp exp1 vars ++ transExp exp2 vars ++ [IAdd]
  
  transExp (Sub exp1 exp2) vars
    = transExp exp1 vars ++ transExp exp2 vars ++ [ISub]
  </code></pre>
  
  <p>Into a single pattern match, so basically convert Add or Sub to a string, add an "I" to the front, and convert it back to a type.</p>