title: Convert String to Integer/Float in Haskell?
body: <pre><code>data GroceryItem = CartItem ItemName Price Quantity | StockItem ItemName Price Quantity
  
  makeGroceryItem :: String -&gt; Float -&gt; Int -&gt; GroceryItem
  makeGroceryItem name price quantity = CartItem name price quantity
  
  I want to create a `GroceryItem` when using a `String` or `[String]`
  
  createGroceryItem :: [String] -&gt; GroceryItem
  createGroceryItem (a:b:c) = makeGroceryItem a b c
  </code></pre>
  <p>The input will be in the format <code>[&quot;Apple&quot;,&quot;15.00&quot;,&quot;5&quot;]</code> which I broke up using Haskell's <code>words</code> function.</p>
  <p>I get the following error which I think is because <code>makeGroceryItem</code> accepts a <code>Float</code> and an <code>Int</code>.</p>
  <pre><code>*Type error in application
  *** Expression     : makeGroceryItem a read b read c
  *** Term           : makeGroceryItem
  *** Type           : String -&gt; Float -&gt; Int -&gt; GroceryItem
  *** Does not match : a -&gt; b -&gt; c -&gt; d -&gt; e -&gt; f*
  </code></pre>
  <p>But how do I make <code>b</code> and <code>c</code> of type <code>Float</code> and <code>Int</code>, respectively?</p>