[Haskell-cafe] question regarding the $ apply operator

2011-07-19 Thread Ting Lei
Hi I have a naive question regarding the basic use of the $ operator, and I am confused why certain times it doesn't seem to work. e.g. The following works: applySkip i f ls = (take i) ls ++ f (drop i ls) But the following doesn't: applySkip i f ls = (take i) ls ++ f $ drop i ls which gives

Re: [Haskell-cafe] question regarding the $ apply operator

2011-07-19 Thread Arlen Cuss
applySkip i f ls = (take i) ls ++ f (drop i ls) But the following doesn't: applySkip i f ls = (take i) ls ++ f $ drop i ls The issue is with operator precedence. The above is equivalent to: applySkip i f ls = ((take i) ls ++ f) (drop i ls) (++) binds more strongly than ($).

Re: [Haskell-cafe] question regarding the $ apply operator

2011-07-19 Thread Brandon Allbery
On Tue, Jul 19, 2011 at 02:16, Ting Lei tin...@hotmail.com wrote: I have a naive question regarding the basic use of the $ operator, and I am confused why certain times it doesn't seem to work. e.g. The following works: applySkip i f ls = (take i) ls ++ f (drop i ls) But the following

Re: [Haskell-cafe] question regarding the $ apply operator

2011-07-19 Thread Ting Lei
Thanks, Brandon, That's a very clear explanation. I remembered that it's low, but forgot that it's this low. Maybe it's because of my mis-understanding that in C, infix operators have lower precedence. Just curious, the following is not allowed in Haskell either for the same reason.

Re: [Haskell-cafe] question regarding the $ apply operator

2011-07-19 Thread Arlen Cuss
Just curious, the following is not allowed in Haskell either for the same reason. applySkip i f ls = (take i) ls ++ $ f $ drop i ls This doesn't work for a slightly different reason; you can't use the infix operators beside each other (++ $), but if you could, it'd work!

Re: [Haskell-cafe] question regarding the $ apply operator

2011-07-19 Thread Ivan Lazar Miljenovic
On 19 July 2011 06:52, Ting Lei tin...@hotmail.com wrote: I read somewhere that people a couple of hundreds of years ago can manage to express things using ($)-like notation without any parenthesis at all. The only thing that I can think of that matches this is Reverse Polish Notation, and

Re: [Haskell-cafe] I confused myself with generics, and now I confused ghc too

2011-07-19 Thread José Pedro Magalhães
Hi Ari, I won't really try to answer your question, but I'll give you the code for gzipWithQ written by Alexey Rodriguez Yakushev some years ago for his comparison on generic programming libraries. The original darcs repo no longer exists, but here is the file which I think is relevant for you:

Re: [Haskell-cafe] partial inheritance

2011-07-19 Thread Malcolm Wallace
On 19/07/2011, at 0:09, Patrick Browne patrick.bro...@dit.ie wrote: instance Bird Emperor where -- No fly method walk x y = y instance Penguin Emperor where -- How can I override the walk method in the instance Penguin? -- walk x y = x Why would you want to override the walk method

Re: [Haskell-cafe] ANN: cabal-dev 0.8

2011-07-19 Thread Herbert Valerio Riedel
On Mon, 2011-07-18 at 15:29 -0700, Bryan O'Sullivan wrote: Wonderful! This is absolutely one of those indispensable tools for build automation and sanity preservation. I use cabal-dev to manage the builds for all of my Haskell projects, under many different configurations:

Re: [Haskell-cafe] ANN: cabal-dev 0.8

2011-07-19 Thread Gregory Collins
On Tue, Jul 19, 2011 at 10:10 AM, Herbert Valerio Riedel h...@gnu.org wrote: On Mon, 2011-07-18 at 15:29 -0700, Bryan O'Sullivan wrote: Wonderful! This is absolutely one of those indispensable tools for build automation and sanity preservation. I use cabal-dev to manage the builds for all of

Re: [Haskell-cafe] partial inheritance

2011-07-19 Thread Yves Parès
I haven't followed the thread carefully but why does the bird have to be a penguin? A bird doesn't have to be a penguin : *instance* (Penguin b) = Bird b where fly = -- fly method for penguins Says that every Penguin is a Bird. But thinking back about it, there is a problem when trying to

Re: [Haskell-cafe] ANN: cabal-dev 0.8

2011-07-19 Thread Herbert Valerio Riedel
On Tue, 2011-07-19 at 10:33 +0200, Gregory Collins wrote: Particular tips from our configuration: * Jenkins is a Java project, and hence gobbles RAM. My VPS couldn't handle it, so I run it over a VPN tunnel to a machine sitting in my living room. * If you set up test-framework to run

Re: [Haskell-cafe] Parsing cabal files to calculate average number of dependencies

2011-07-19 Thread Henning Thielemann
On 02.07.2011 01:26, Gwern Branwen wrote: Another thing you can do along the same lines is generate a script to download all the repos from packages which declare repos. Some ugly code: If 'script' also includes Haskell code, then the 'tar' package could be of help to walk throught the TAR

Re: [Haskell-cafe] partial inheritance

2011-07-19 Thread Maciej Piechotka
On Tue, 2011-07-19 at 10:43 +0200, Yves Parès wrote: I haven't followed the thread carefully but why does the bird have to be a penguin? A bird doesn't have to be a penguin : instance (Penguin b) = Bird b where fly = -- fly method for penguins Says that every Penguin is a Bird.

Re: [Haskell-cafe] question regarding the $ apply operator

2011-07-19 Thread Maciej Marcin Piechotka
On Tue, 2011-07-19 at 07:11 +, Ivan Lazar Miljenovic wrote: On 19 July 2011 06:52, Ting Lei tin...@hotmail.com wrote: I read somewhere that people a couple of hundreds of years ago can manage to express things using ($)-like notation without any parenthesis at all. The only thing

Re: [Haskell-cafe] question regarding the $ apply operator

2011-07-19 Thread Ivan Lazar Miljenovic
On 19 July 2011 09:51, Maciej Marcin Piechotka uzytkown...@gmail.com wrote: On Tue, 2011-07-19 at 07:11 +, Ivan Lazar Miljenovic wrote: The only thing that I can think of that matches this is Reverse Polish Notation, and according to Wikipedia was about 90 years ago, not hundreds ;-) I

[Haskell-cafe] Ur tutorial, and a challenge

2011-07-19 Thread Adam Chlipala
Last week, I posted a message to this list looking for people interested in joining projects using my domain-specific language Ur/Web. Some responses rightly chastised me for the lack of documentation on the core Ur language's novel type system features. I'm sure many Haskellers have had the

[Haskell-cafe] Haskell fgl example

2011-07-19 Thread Rohit Agrawalla
I am new to haskell and the haskell fgl (functional graph library). l am looking for some examples of the haskell fgl. Would appreciate any pointers regarding the same. -- Rohit ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Haskell fgl example

2011-07-19 Thread Eugene Kirpichov
I've got a small example here https://github.com/jkff/minxmod/blob/master/Buchi.hs . 2011/7/19 Rohit Agrawalla rohit.agrawa...@gmail.com: I am new to haskell and the haskell fgl (functional graph library). l am looking for some examples of the haskell fgl. Would appreciate any pointers

Re: [Haskell-cafe] question regarding the $ apply operator

2011-07-19 Thread Brent Yorgey
On Mon, Jul 18, 2011 at 11:52:15PM -0700, Ting Lei wrote: Thanks, Brandon, That's a very clear explanation. I remembered that it's low, but forgot that it's this low. Maybe it's because of my mis-understanding that in C, infix operators have lower precedence. Just curious, the

Re: [Haskell-cafe] derive + quickCheck

2011-07-19 Thread bob zhang
Hi, thank you . I read your souce, I found the depth is only 2, right? like data A = [A]|String, any easy way to control the maximum_depth of generated data? Regards,bob 于 11-7-17 下午8:13, Ivan Lazar Miljenovic 写道: On 17 July 2011 23:42, bob zhangbobzhang1...@gmail.com wrote: Hi,

Re: [Haskell-cafe] derive + quickCheck

2011-07-19 Thread Ivan Lazar Miljenovic
On 19 July 2011 21:23, bob zhang bobzhang1...@gmail.com wrote: Hi,   thank you .   I read your souce, I found the depth is only 2, right?  like data A = [A]|String, any easy way to control the maximum_depth of generated data? You could always use an Int parameter instead of a Bool and have

Re: [Haskell-cafe] question regarding the $ apply operator

2011-07-19 Thread Richard O'Keefe
Polish notation was indeed published in 1920. However, it relies on knowing the arity of each symbol. Put another way, it relies on symbols *having* definite arities. Thus if f has 2 arguments, it has 2, not 1. This does not suit languages like Haskell at all well. Worse, as usually

[Haskell-cafe] pointer equality

2011-07-19 Thread Nikhil A. Patil
Hi, Is there any way of getting the following code to immediately return True without performing the element-by-element comparison? Essentially this boils down to checking whether pointers are equal before comparing the contents. main = print $ f == f where f = [1..10^9] Thanks!! nikhil

Re: [Haskell-cafe] pointer equality

2011-07-19 Thread Brandon Allbery
On Tue, Jul 19, 2011 at 23:51, Nikhil A. Patil patil.nik...@gmail.comwrote: Is there any way of getting the following code to immediately return True without performing the element-by-element comparison? Essentially this boils down to checking whether pointers are equal before comparing the

Re: [Haskell-cafe] pointer equality

2011-07-19 Thread Eugene Kirpichov
reallyUnsafePointerEq#, and it really is as unsafe as it sounds :) 20.07.2011, в 7:51, Nikhil A. Patil patil.nik...@gmail.com написал(а): Hi, Is there any way of getting the following code to immediately return True without performing the element-by-element comparison? Essentially this