[Haskell-cafe] annoying output

2007-12-08 Thread Ryan Bloor
hi The code below does almost what I want but not quite! It outputs...parseInt 12444a gives... [(EInt 1,2444a),(EInt 2,444a),(EInt 4,44a),(EInt 4,4a),(EInt 4,a)] What I want is: [(EInt 12444, a)] data Expr = EInt {vInt :: Int} -- integer values | EBool {vBool :: Bool} -- boolean

Re: [Haskell-cafe] annoying output

2007-12-08 Thread Philip Weaver
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 'read' command, like this: parseInt :: String - (Expr, String) parseInt xs

Re: [Haskell-cafe] annoying output

2007-12-08 Thread Philip Weaver
I mean powers of *ten* :) On Dec 8, 2007 10:48 PM, Philip Weaver [EMAIL PROTECTED] wrote: 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