Well, you're choosing to parse each digit of your integer as a separate
integer, so if you want to combine them after reading you'll need to
multiply by powers of two.  Or, you can just read in all the digits in
one &#39;read&#39; command, like this:<br>

<br>
&nbsp;&nbsp; parseInt :: String -&gt; (Expr, String)<br>

&nbsp;&nbsp; parseInt xs = let (digits, rest) = span isDigit <br>

&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in (EInt (read digits), rest)<br>

<br>

where &#39;span&#39; is defined in the Prelude.&nbsp; Hope this helps!<br>

<br>

- Phil<br><br><div class="gmail_quote">On Dec 8, 2007 10:03 PM, Ryan Bloor &lt;<a href="mailto:ryanbloor@hotmail.com">ryanbloor@hotmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">




<div>hi<br>
&nbsp;<br>
The code below does almost what I want but not quite! It outputs...<font size="2">parseInt &quot;12444a&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gives...<br>
[(EInt 1,&quot;2444a&quot;),(EInt 2,&quot;444a&quot;),(EInt 4,&quot;44a&quot;),(EInt 4,&quot;4a&quot;),(EInt 4,&quot;a&quot;)]<br></font>
&nbsp;<br>
What I want is: [(EInt 12444, &quot;a&quot;)]<br>
&nbsp;<br>
data Expr = EInt {vInt :: Int} -- integer values<br>&nbsp;| EBool {vBool :: Bool} -- boolean values<br>
&nbsp;<br>
parseInt :: Parser <br>parseInt (<font face="">x:xs</font>)<br>&nbsp;| (isDigit x &amp;&amp; xs /= []) = [(EInt (read [x]),xs)] ++ parseInt xs<br>&nbsp;| isDigit x &amp;&amp; xs == [] = [(EInt (read [x]),[])]<br>&nbsp;| otherwise = []<br>

&nbsp;<br>
Thanks<br>
&nbsp;<br>
Ryan<br>
&nbsp;<br>
&nbsp;<br>
&nbsp;<br>
&nbsp;<br><br><hr>Get closer to the jungle. <a href="http://entertainment.uk.msn.com/tv/realitytv/im-a-celebrity/" target="_blank">I&#39;m a Celebrity Get Me Out Of Here!</a></div>
<br>_______________________________________________<br>Haskell-Cafe mailing list<br><a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">
http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br><br></blockquote></div><br>