
9 Dec
2007
9 Dec
'07
1:03 a.m.
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 values parseInt :: Parser parseInt (x:xs) | (isDigit x && xs /= []) = [(EInt (read [x]),xs)] ++ parseInt xs | isDigit x && xs == [] = [(EInt (read [x]),[])] | otherwise = [] Thanks Ryan _________________________________________________________________ Who's friends with who and co-starred in what? http://www.searchgamesbox.com/celebrityseparation.shtml