
Sorry for answering my own question :
end <- try (float haskelldef)
<|> (fmap fromInteger $ integer haskelldef )
appears to work nicelly. Sorry about that.
/Fredrik
On Sun, Jul 7, 2013 at 1:57 PM, Fredrik Karlsson
Dear list,
Sorry for asking you another parsec question. I have a text file that is the output of a C/C++ program, involving time references in double format. Now, the program seems to truncate the output if possible, so a file that is one second long will produce this file:
File type = "ooTextFile" Object class = "TextGrid"
xmin = 0 xmax = 1 ....
and a file that is 1.1 seconds long will be this:
File type = "ooTextFile" Object class = "TextGrid"
xmin = 0 xmax = 1.1 ...
Now, how do I handle this case in parsec?
I have tried this:
start <- try (float haskellDef) <|> fmap ( / 1.0 ) $ integer haskelldef
and similar solutions, but I cant get it to accept the 0.
/Fredrik
-- "Life is like a trumpet - if you don't put anything into it, you don't get anything out of it."
-- "Life is like a trumpet - if you don't put anything into it, you don't get anything out of it."