[Haskell-cafe] Parsec : parse either an interger or a double?

2013-07-07 Thread 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.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Parsec : parse either an interger or a double?

2013-07-07 Thread Fredrik Karlsson
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 dargo...@gmail.com wrote:

 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.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Catch multiple exceptions using 'Control.Exception'

2013-07-07 Thread Albert Y. C. Lai

On 13-07-06 12:12 PM, Nikita Karetnikov wrote:

Is there an open sum type or a closed existential type?


OCaml has open sum types.

I haven't really seen closed existential types. (I have seen some 
approximations, but each lacks one last bit.)



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Linux users needed for OpenGL extensions survey

2013-07-07 Thread Brian Lewis
Hi, I'm doing a survey to find out how well various OpenGL extensions
are supported, to know where to focus efforts on Haskell game software.

If you run Linux on your desktop and want to help, here's how:

1.) Save the information like this:
$ glxinfo  SOMENAME.glxinfo
... where SOMENAME is your name, or nickname, or the computer's
name, whatever you like.
If you don't have glxinfo, you might need to install mesa-utils on
Ubuntu, or mesa-demos on Arch.

2.) Ensure the file contains information about OpenGL extensions
supported by your graphics card.

3.) Attach it to me *off list*.

If you have questions, please ask me *off list*.

If there's interest, I'll make the survey results available.

Thanks!

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe