Re: [Haskell-cafe] GetOpt

2006-04-27 Thread Tomasz Zielonka
On Thu, Apr 27, 2006 at 02:26:22AM +0300, Einar Karttunen wrote: On 26.04 11:29, Anton Kulchitsky wrote: I just started to study Haskell and it is my almost first big experience with functional languages (except Emacs Lisp and Python). I enjoyed all small exercises and started a bigger

Re: [Haskell-cafe] Current situation regarding global IORefs

2006-04-27 Thread Adrian Hey
Lennart Augustsson wrote: I was going to respond, but Cale very eloquently said most of what I was thinking. I don't think eloquent is the word I would use, but I'm certainly glad you didn't feel the need to repeat all that. It'd be really nice if just for once the global mutable state is evil

Re: [Haskell-cafe] GetOpt

2006-04-27 Thread Mirko Rahn
Tomasz Zielonka wrote: On Thu, Apr 27, 2006 at 02:26:22AM +0300, Einar Karttunen wrote: and handle options as functions from Config to Config: Option ['i'] [input] (ReqArg (\x c - c { infile = Just x }) file) input file name I find this approach very convenient, but I push it a bit

Re: [Haskell-cafe] GetOpt

2006-04-27 Thread Bulat Ziganshin
Hello Anton, Wednesday, April 26, 2006, 11:29:16 PM, you wrote: I just started to study Haskell and it is my almost first big experience with functional languages (except Emacs Lisp and Python). I enjoyed all small exercises and started a bigger business writing a general utility. you are my

Re: [Haskell-cafe] Current situation regarding global IORefs

2006-04-27 Thread Lennart Augustsson
Not to fuel the flame war, I will limit myself to two comments. Adrian Hey wrote: Or put another way, would it be possible to implement the socket API, exactly as it currently is, entirely in Haskell, starting with nothing but hardware? I don't believe it is possible, but perhaps somebody can

Re: [Haskell-cafe] GetOpt

2006-04-27 Thread Tomasz Zielonka
On Thu, Apr 27, 2006 at 03:10:32PM +0400, Bulat Ziganshin wrote: i don't like the GetOpt interface (it returns a list of options what is unusable for high-speed application) This got me interested. I assume that you measured performace and it wasn't fast enough. How many command line args you

[Haskell-cafe] database access recommendation

2006-04-27 Thread Brock Peabody
I'm teaching myself Haskell, and was wondering if anyone could recommend a library for accessing databases, PostgreSQL in particular. I looked at http://www.haskell.org/haskellwiki/Libraries_and_tools, and HSQL looked promising, but I can't get it to install on Windows or FreeBSD, with Hugs or

Re: [Haskell-cafe] database access recommendation

2006-04-27 Thread Neil Mitchell
Hi It fails with Hugs on both platforms on the runhugs Setup.lhs configure step in the base HSQL library with: Windows: ERROR C:\Program Files\WinHugs\libraries\Text\ParserCombinators\ReadP.hs:156 - Syntax error in type expression (unexpected `.') That looks like it requires haskell

Re: [Haskell-cafe] database access recommendation

2006-04-27 Thread Duncan Coutts
On Thu, 2006-04-27 at 10:45 -0500, Brock Peabody wrote: I'm teaching myself Haskell, and was wondering if anyone could recommend a library for accessing databases, PostgreSQL in particular. I looked at http://www.haskell.org/haskellwiki/Libraries_and_tools, and HSQL looked promising, but I

RE: [Haskell-cafe] database access recommendation

2006-04-27 Thread Brock Peabody
From: Duncan Coutts [mailto:[EMAIL PROTECTED] There is also HDBC which is nearing a 1.0 release and in my experience is easier to install. (I package both HSQL HDBC for Gentoo) Thanks, I'll check that out. For some reason I saw HDBC and just assumed it was an interface for ODBC. Brock

RE: [Haskell-cafe] database access recommendation

2006-04-27 Thread Duncan Coutts
On Thu, 2006-04-27 at 11:50 -0500, Brock Peabody wrote: From: Duncan Coutts [mailto:[EMAIL PROTECTED] There is also HDBC which is nearing a 1.0 release and in my experience is easier to install. (I package both HSQL HDBC for Gentoo) Thanks, I'll check that out. For some reason I saw

RE: [Haskell-cafe] database access recommendation

2006-04-27 Thread Brock Peabody
From: Duncan Coutts [mailto:[EMAIL PROTECTED] It's that too! And SQLite and you can write other backends independently. Sounds cool! Unfortunately I'm having problems installing it but I think it's probably something simple this time. I can configure, build, and install hdbc. When I try to

Re[2]: [Haskell-cafe] GetOpt

2006-04-27 Thread Bulat Ziganshin
Hello Tomasz, Thursday, April 27, 2006, 4:45:45 PM, you wrote: On Thu, Apr 27, 2006 at 03:10:32PM +0400, Bulat Ziganshin wrote: i don't like the GetOpt interface (it returns a list of options what is unusable for high-speed application) This got me interested. I assume that you measured

Re: [Haskell-cafe] Current situation regarding global IORefs

2006-04-27 Thread John Meacham
On Thu, Apr 27, 2006 at 11:09:58AM +0100, Adrian Hey wrote: What really frustrates me about all this is that AFAIK there are no significant technical or theoretical reasons why we can't get this safety (without resort to the unsafePerformIO hack). The only serious obstacle seems political,

Re: Re[2]: [Haskell-cafe] GetOpt

2006-04-27 Thread Brian Hulley
Bulat Ziganshin wrote: Hello Tomasz, [snip] ultimately, the main problem of all options-parsing stuff i ever seen, is requirement to repeat option definition many times. if i have, say, 40 options, then i need to maintain 3 to 5 program fragments that deal with each option. something like this:

Re: [Haskell-cafe] GetOpt

2006-04-27 Thread Einar Karttunen
On 27.04 12:32, Mirko Rahn wrote: So it would be much better to define the options in the library and to provide this definitions to the user program somehow. I tought about this topic several times and came up with a solution that works for me but is far from being perfect. It uses

Re: [Haskell-cafe] GetOpt

2006-04-27 Thread Anton Kulchitsky
I find this approach very convenient, but I push it a bit further. Some time ago I wrote a small article about this: http://www.haskell.org/pipermail/haskell/2004-January/013412.html I was not the first one to use the approach but I felt that it should be made more popular. Perhaps I

Re: [Haskell-cafe] Current situation regarding global IORefs

2006-04-27 Thread Brian Hulley
John Meacham wrote: On Thu, Apr 27, 2006 at 11:09:58AM +0100, Adrian Hey wrote: What really frustrates me about all this is that AFAIK there are no significant technical or theoretical reasons why we can't get this safety (without resort to the unsafePerformIO hack). The only serious obstacle

Re: [Haskell-cafe] GetOpt

2006-04-27 Thread Anton Kulchitsky
Hi Bulat, thank you very much for such a detailed reply! I just started to study Haskell and it is my almost first big experience with functional languages (except Emacs Lisp and Python). I enjoyed all small exercises and started a bigger business writing a general utility. you are my

Re: Re[2]: [Haskell-cafe] GetOpt

2006-04-27 Thread Brian Hulley
Brian Hulley wrote: moduleOptions = ComposedOption My module [ModOption1, ModOption2] moduleOptions = Option $ ComposedOption My module [ModOption1, ModOption2] allOptions = ComposedOption Name of program [Module1.moduleOptions, allOptions = Option $ ComposedOption Name of program

Re: [Haskell-cafe] Current situation regarding global IORefs

2006-04-27 Thread John Meacham
On Thu, Apr 27, 2006 at 09:53:35PM +0100, Brian Hulley wrote: At the moment, there is a strange unnatural discrepancy between the fixed set of built-in privileged operations such as newUnique which are allowed to make use of global state and user defined operations which have to rely on a

Re: [Haskell-cafe] GetOpt

2006-04-27 Thread John Meacham
I wrote an option parser that infers everything about the options from the types of what you pull out of it so there is no need to specify redundant information and you can write very concise code (especially when combined with the overloaded regex module!) like for instance main = do

[Haskell-cafe] short yet featureful grep

2006-04-27 Thread John Meacham
my favorite example is the featureful yet short grep, supporting quite a few non-trivial options as well as a detailed '--help' message. :) this is a great example for anyone that says strong typing clutters code :) Haskell can be much more concise as well as safer than perl given the right

[Haskell-cafe] Newbie Instance Of Floating Int Error

2006-04-27 Thread Aditya Siram
Hi all, I just started working with Haskell and am having some difficulties with its type system. Here is function that is supposed to calculate the distance between two coordinates: distBetween (x1,y1) (x2,y2) = sqrt((x2-x1)^2 + (y2-y1)^2) I am trying to explictly give it a type signature.