Re[2]: [Haskell-cafe] Re: speed: ghc vs gcc
Hello Don, Saturday, February 21, 2009, 1:55:19 AM, you wrote: This is extremely depressing to read after the good results and lessons of this thread. you misunderstand, it is not personal! We just want something to sarcasm on. Something specific. -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] speed: ghc vs gcc
Hello Khudyakov, Saturday, February 21, 2009, 2:07:39 AM, you wrote: I have another question. Why shouldn't compiler realize that `sum [1..10^9]' is constant and thus evaluate it at compile time? since we expect that compilation will be done in reasonable amount of time. you cannot guarantee this for list-involving computation -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[4]: [Haskell-cafe] speed: ghc vs gcc vs jhc
Hello John, Saturday, February 21, 2009, 2:14:25 AM, you wrote: Heh. He probably meant something more like jhc is not a production compiler which is true for a lot of projects. For projects of substantial size or that require many extensions, jhc falls somewhat short. It is getting better though. Of course, help is always appreciated. :) what is substantial size? can jhc be used for video codec, i.e. probably no extensions - just raw computations, and thousands or tens of thousands LOCs? -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[6]: [Haskell-cafe] Re: speed: ghc vs gcc
Hello Peter, Saturday, February 21, 2009, 2:36:15 AM, you wrote: nothing should stop you from writing video games in Haskell since video codec isn't video game :))) but I've worked with people that wrote physics engines in C/C++, and they also had to hand optimize specifically for a certain compiler to get things fast. that's important signal. if you need to hand-optimize your code even if you use icl to compile it, using haskell will be like hunting with a hand instead of gun -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re: speed: ghc vs gcc
Hello Sebastian, Saturday, February 21, 2009, 2:42:33 AM, you wrote: Bulat, please, you're missing the point. actually you are missing the point. i mirror Don's non-attacking style of comments on my person. are you mentioned those Don letter? sure - no Nobody is saying that the template-haskell trick was somehow a viable general strategy right now that everyone should use by default. It was used as a proof-of-concept that a simple technique can lead to massive performance improvements - and we get numbers for how massive it would be (beating gcc for this benchmark). sorry, but you was fooled too. the situation was the following: i wrote non-optimal code for 64-bit platforms (using 32-bit int) and Don don't corrected it. then he compiled TH-generated code via *gcc* that used fusion technique - the same that was used by 32-bit C++ code are you wondered why -D64 version is 8 times faster than -D8 one? it's exactly because *gcc* reduced 64 additions to just one operation. so this fair comparison used TH+gcc to generate faster code than gcc with improper data type definitions. if Don will fix C++ program, he will find that it's speed reduced in the same proportion - without TH tricks This isn't about faking a benchmark, it's about investigating the reasons for why the benchmark looks they way it does, doing testing to verify the assumptions (in this case using TH), and making constructive suggestions (add loop-unrolling to the compiler). This investigation tells us that in this case a compiler could beat gcc, if only it were to do loop unrolling in the way the TH code does. That's a result! yes, in the cases when *gcc* fuse loops and you don't allow it do it for C++ code but allows for Haskell - you will win I would ask you to note the simple fact that every single constructive message in this thread has come from people other than you. you are ignore, though, the fact that every destructive message in this thread comes against me. it seems that it's a crime here to write about ghc speed anything but praise. in best case people will said that these tests are destructive :lol: I hope this leads you reconsider your tone and general approach in the future. Haskell people in general are always pretty good at accepting criticism IME (they tend to want to fix the problem), that criticism??? cows can't fly, and ghc cannot beat gcc in 2 months. that bothers me is people that attack me just for comparing compilers head-to-head -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: speed: ghc vs gcc
Hello Achim, Saturday, February 21, 2009, 2:37:55 AM, you wrote: not having enough weight in the shootout. For now, you can just use TH to force things getting evaluated. (Try to do that in C) they have Templates axe too :) -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] speed: ghc vs gcc vs jhc
Hello John, Saturday, February 21, 2009, 2:49:25 AM, you wrote: what is substantial size? can jhc be used for video codec, i.e. probably no extensions - just raw computations, and thousands or tens of thousands LOCs? Perhaps. A bigger issue in practice is that the larger a program is, the more likely it is to depend on some library that depends on a ghc extension. this is true for *application* code, but for codec you may have lots of code that just compute, compute, compute -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] speed: ghc vs gcc
Hello Xiao-Yong, Saturday, February 21, 2009, 3:16:28 AM, you wrote: some C++ compilers can already do this (profile based optimization). Rumor says firefox needs profile based optimization to run faster. Or it is not a rumor at all. why it's rumor? PGO is natural optimization technique, just like loop unrolling or register allocation -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[4]: [Haskell-cafe] Re: speed: ghc vs gcc
Hello Isaac, Saturday, February 21, 2009, 3:28:31 AM, you wrote: When did you look - six months ago? a year ago? 3 years ago? ah, again this argument. two weeks ago Don said that ghc changed a lot in 2 years, now when we see that there is no difference, he says that those loop optimizer is somewhere noone know where. now i should look into new set of tests just because everyone else believe that ghc is shiny. please look yourself, i will continue to say about testset i have seen when 6.6 arrived most of these tests depends on libraries speed Most? 2 of 12 strongly depend on libraries because PCRE and GMP are explicitly allowed. *were* depending on libs speed. in particular, haskell's triumph - multithreading tests, chameneos or so in one test, PHP is 1st I don't believe that has ever been true - which test? large regexps one Please note that sum-file has not been included since autumn 2008. ok -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] speed: ghc vs gcc vs jhc
Hello John, Saturday, February 21, 2009, 3:42:24 AM, you wrote: this is true for *application* code, but for codec you may have lots of code that just compute, compute, compute Yes indeed. If there is code like this out there for haskell, I would love to add it as a test case for jhc. Crypto library has a lot of native haskell code computing hashes and encrypting data hopefully people will show other examples btw, Galois Cryptol has haskell backend, are you know? with jhс compilation it can probably generate as fast code as C backend does. it will be very interesting for us and even look as something close to production usage. i have crossposted message to Don I don't see a reason it wouldn't compile to be as fast as C, with the caveat that the strictness analyzer needs to be able to find all the unboxables. there is one problem with haskell - it doesn't support variables and complex control structures. this means that sometimes you need to wrote more complex code to handle situation and as a result, it may be slower than native C -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re[2]: Ready for testing: Unicode support for Handle I/O
Hello Simon, Thursday, February 19, 2009, 3:21:03 PM, you wrote: Correct - I'm aware that there's a problem with filenames, but it hasn't been tackled yet. There probably isn't anything sensible that we can do without changing FilePath into an ADT. i think that FilePath=String is ok, we just need to use utf8 string encoding on unix/macs and utf-16 encoding with *W functions on Windows. i have implemented such support inside my own application, and would be happy to mentor appropriate gsoc project -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re[2]: Ready for testing: Unicode support for Handle I/O
Hello Khudyakov, Thursday, February 19, 2009, 4:06:06 PM, you wrote: i think that FilePath=String is ok, we just need to use utf8 string encoding on unix/macs and utf-16 encoding with *W functions on Windows. i have implemented such support inside my own application, and would be happy to mentor appropriate gsoc project It won't _always_ work. current solution works never :) And there are still 8-bit locales lurking somewhere in bush. UTF8 isn't appropriate for them at all. i think that SetFilenameEncoding whould solve this, among with access to lower-level openFileUsingCStringPath -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Uses of `fix' combinator
Hello Khudyakov, Thursday, February 19, 2009, 5:00:03 PM, you wrote: I have two questions. How could this function be used? I'm unable to imagine any. Naive approach lead to nothing (no surprise): fix (1:) -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re: [Haskell] ANNOUNCE: first Grapefruit release
Hello Wolfgang, Wednesday, February 18, 2009, 12:17:16 PM, you wrote: Win32-based backend would make more sense as it is one less layer to deal with. But how? Same thing with Mac. A student of mine wrote a fully automatic binding generator for C++ libraries which also supports Qt extensions (signals and slots). (However, this guy still has to give me the code. :-/ ) One could do a similar thing for generating Win32 and Cocoa bindings. Then one could write Grapefruit UI backends based on these bindings. win32 api is, not c++, and for this purpose hsffig also exists -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] estimating the speed of operation
Hello Belka, Wednesday, February 18, 2009, 1:15:32 PM, you wrote: sequence_ (replicate n (return $ md5 input_row)) $! -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] question on types
Hello Conor, Wednesday, February 18, 2009, 4:12:07 PM, you wrote: type-level integers that don't suck and then some... Start date will be October 2009 or so. hurray!!! -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to create an online poll
Hello haskell-cafe, http://zohopolls.com/ -- Best regards, Bulat mailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Race condition possible?
Hello Peter, Friday, February 13, 2009, 2:17:52 AM, you wrote: If so, how would it be possible to make sure that the operation of reading the current time and writing the pair to the MVar is an atomic operation, in the sense that no thread switch can happen between the two? Would this require STM? it may be better to change architecture so that you no more need atomic operations - these are unnatural for mvar/chan approach -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re: [Haskell] Google Summer of Code 2009
Hello Jamie, Wednesday, February 11, 2009, 5:54:09 AM, you wrote: Seems like it is ok to write H.264 in Haskell and released via GPL license? anyway it's impossible due to slow code generated by ghc -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re: [Haskell] Google Summer of Code 2009
Hello Don, Wednesday, February 11, 2009, 8:28:33 PM, you wrote: anyway it's impossible due to slow code generated by ghc Been a long time since you did high perf code -- we routinely now write code that previously was considered not feasible. which is still slower than C and need more time to write However, I would say it needs an optimisation expert, yes, in any language. there are experts, includingyou, in making haskell specific code as fast as possible, but i don't know anyone using haskell to write high-performance code. so you ask for non-existing specialists -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re[2]: [Haskell] Google Summer of Code
Hello John, Wednesday, February 11, 2009, 8:54:35 PM, you wrote: I know you've talked about performance in the past, and I don't want to start a huge argument, but do you have recent data to back this up? IIRC you're using ghc 6.6, yes? i don't seen examples of high-performance code written by anyone else which would be as simple and as fast as C analogue. afaik ghc now can generate good code for tight loops, but gcc optimizations goes far beyond this. if you know specialists writing HP code in haskell and results of their work - please point us to these code I haven't looked at H.264 (and I realize it's compressed, so the situation is different from my work), however ghc can generate very fast code for binary I/O it's exactly example of tight loop. and let's compare HP code written for this task with analogous code written in C. i expect that haskell code is much more complex .Check out (shameless self-promotion) http://johnlato.blogspot.com for my recent writeup on creating a high-performance, pure-Haskell, Iteratee-based WAVE file reader. afaiu, it's 20-line equivalent of 2-line C code: for (i=...) a[i] = b[i] does this need any more comments? unfortunately, your post doesn't contain equivalent C code and its performance measurements, so i can't consider this as argument for ghc/gcc comparison. all that i see there is large complex code that proves that HP haskell programming is much more complex than C one Sincerely, John Lato anyway it's impossible due to slow code generated by ghc -- Best regards, Bulatmailto:bulat.zigans...@gmail.com -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re[4]: [Haskell] Google Summer of Code
Hello John, Wednesday, February 11, 2009, 11:55:47 PM, you wrote: it's exactly example of tight loop. and let's compare HP code written for this task with analogous code written in C. i expect that haskell code is much more complex I think it's fair to point out that tight loops are nearly always the biggest bottlenecks of code, so generating good code for tight loops is pretty important. it's important, but doesnt't make whole game. and while i said that ghc improved tight loops compilation, this doesn't mean that it becomes the same as in gcc. it just started to put loop variables into register And ghc is still making large improvements with each release, whereas gcc isn't likely to get significantly better. yes, it's close to perfect afaiu, it's 20-line equivalent of 2-line C code: for (i=...) a[i] = b[i] does this need any more comments? I think you've misunderstood my code. Look at Oleg's IterateeM and see if you think that's really all it's doing. what else does the code that you've citated? you are wrote that it just copies 16-bit words into doubles Use libsndfile for comparison. http://www.mega-nerd.com/libsndfile/. it's one method of miscomparing haskell to C - compare hand-tuned haskell code with some C code which may be just not optimal. ig you want to make fair comparison, you should write best code in both languages I actually haven't looked at the code, although it's very highly regarded in the audio community (and I've seen the author post on this list on occasion). Using libsndfile-1.0.18: wc wav.c 17867833 57922 wav.c compared to my source: wc Wave.hs 4122215 15472 Wave.hs And there you are. I will admit that I have implemented the entire wave spec, but only because of lack of time. when you don't need speed, you may write more compact code in haskell than in C. so the best way is to split your task into speed-critical part and the rest and use C++ for the first and Haskell for the second -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re: [Haskell] Google Summer of Code 2009
Hello Don, Wednesday, February 11, 2009, 11:58:13 PM, you wrote: fast as possible, but i don't know anyone using haskell to write high-performance code. so you ask for non-existing specialists We're doing it at Galois regularly. Check out the blog. i scanned through http://www.galois.com/blog/category/haskell/ and don't found anything about this. probably we mean different things - i'm saying about implementation of cpu-intensive algorithms like deflate, md5 or mpeg for crypto-algos we have haskell library and afair it was 3-10 times slower than C equivalents and probably harder to write too? -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re[4]: [Haskell] Google Summer of Code
Hello Don, Thursday, February 12, 2009, 12:23:16 AM, you wrote: Check out what GHC is doing these days, and come back with an analysis of what still needs to be improved. We can't wait to hear! can you point me to any haskell code that is as fast as it's C equivalent? -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re[4]: [Haskell] Google Summer of Code
Hello Don, Thursday, February 12, 2009, 3:45:36 AM, you wrote: You should do your own benchmarking! well, when you say that ghc can generate code that is fast as gcc, i expect that you can supply some arguments. is the your only argument that ghc was improved in last years? :) -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Efficient string output
Hello Ketil, Monday, February 9, 2009, 2:49:05 PM, you wrote: in B.concat [f1,pack \t,pack (show f2),...] inelegance were it only fast - but this ends up taking the better part of the execution time. i'm not a BS expert but it seems that you produce Strings using show and then convert them to BS. of course this is inefficient - you need to replace show with BS analog -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] threadDelay
Hello Immanuel, Monday, February 9, 2009, 3:42:24 PM, you wrote: Am I correct in assuming this program should run 100 secs? real 0m0.104s may be, 100 msecs? :) -- | Suspends the current thread for a given number of microseconds -- (GHC only). -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] lazy evaluation is not complete
Hello Peter, Monday, February 9, 2009, 5:10:22 PM, you wrote: If run with ghci, foo 5 does not terminate, i.e., Haskell does not look for all outermost redices in parallel. Why? For efficiency reasons? of course. if you will create new thread for every cpu instruction executed, you will definitely never compute anything :D you need to use `par` -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Why does sleep not work?
Hello John, Tuesday, February 10, 2009, 12:35:25 AM, you wrote: I am finding that using the sleep function doesn't sleep at all, whereas using threadDelay does: Anybody know what's happening? 1) this depends on your sleep definition 2) read threadDelay docs -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Ready for testing: Unicode support for Handle I/O
Hello Khudyakov, Saturday, February 7, 2009, 4:01:57 PM, you wrote: How do you plan to handle filenames? Currently FilePath is simply a string. i think that this patch does nothing to unicode filenames support -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] The Haskell re-branding exercise
Hello Don, Saturday, February 7, 2009, 8:20:23 PM, you wrote: We need a voting site set up. There was some progress prior to the end of the year. Updates welcome! i think that there are a lot of free voting/survey services available. the last one i went through was LimeSurvey available for any SF project and on separate site too http://apps.sourceforge.net/trac/sitedocs/wiki/Hosted%20Apps https://www.limeservice.com/ -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (Off-topic) CUDA
Hello Andrew, Thursday, February 5, 2009, 11:10:42 AM, you wrote: Does anybody know how to make this stuff actually work? nvidia has cuda site where you can download sdk. afair, dr dobbs journal has (online) series of arcticles which describes how to program it step-by-step (Also... Haskell on the GPU. It's been talked about for years, but will it ever actually happen?) gpu is just set of simd-like instructions. so the reason why you will never see haskell on gpu is the same as why you will never see it implemented via simd instructions :D -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] How to properly design a Haskell TK
Hello Luke, Friday, February 6, 2009, 11:09:45 AM, you wrote: I've been thinking a bit, and come to the conclusion that we should just do it as others did it before: Start off with application-specific tk's, figure out what's cool and what's compatible and then put them into libraries. In short: Stop building cathedrals. I don't know what you mean by TK, but whatever it means, I wholeheartedly support this sentiment! he said tk, and i think that his sentence quantified over any tk :) -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] (Off-topic) CUDA
Hello Malcolm, Friday, February 6, 2009, 11:49:56 AM, you wrote: gpu is just set of simd-like instructions. so the reason why you will never see haskell on gpu is the same as why you will never see it implemented via simd instructions :D Because SIMD/GPU deals only with numbers, not pointers, you will not see much _symbolic_ computation being offloaded to these arithmetic units. But there are still great opportunities to improve Haskell's speed at numerics using them. And some symbolic problems can be encoded using integers. are you learned gpu asm? the *only* type of problems it can effectively run is massive-parallel computations. you can run anything on it, but much slower that on cpu There are at least two current (but incomplete) projects in this area: Sean Lee at UNSW has targetted Data Parallel Haskell for an Nvidia GPGPU, and Joel Svensson at Chalmers is developing a Haskell-embedded language for GPU programming called Obsidian. key word here *parallel*, i.e. simd computations -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] evaluation semantics of bind
Hello Gregg, Thursday, February 5, 2009, 6:20:06 PM, you wrote: An optimizer can see that the result of the first getChar is discarded and replace the entire expression with one getChar without changing the formal semantics. this is prohibited by using pseudo-value of type RealWorld which is passed through entire action stream. actually, order of execution is controlled by dependencies on this values http://haskell.org/haskellwiki/IO_inside -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] pure crisis :)
Hello haskell-cafe, pure functional denotation for crisis: (_|_) -- Best regards, Bulat mailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: filestore 0.1
Hello Gwern, Sunday, January 25, 2009, 2:56:07 AM, you wrote: my usual complaint: it will be great to see all announces duplicated in main haskell list ANN filestore 0.1 We are pleased to announce the first release of a new library, filestore. What is it? filestore provides a uniform, abstract, generic interface for storing versioned files on disk. It allows calling programs to use generic commands to store strings or binary data and perform various queries, such as 'what files are in this repository?' or 'what were the contents of this file at revision XXX?' or 'give me a diff of this file between revision XXX and revision YYY.' Because the interface is abstract, the calling program is insulated from the messy details of the backend (which might be a VCS or a database). What backends are supported? Darcs and Git are fully supported. There are plans for a SQLite backend. What is this good for? Currently it is used by two wikis, Gitit and Orchid. We hope it will see use in other applications as well that need to version data and would like the various advantages of DVCSs (such as easy collaboration, advanced merging, etc.). Where can you get it? Your local cabal-install, Hackage at http://hackage.haskell.org/cgi-bin/hackage-scripts/package/filestore and of course you can do 'darcs get http://johnmacfarlane.net/repos/filestore' for the very latest. filestore was written by John MacFarlane, Gwern Branwen, and Sebastiaan Visser -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Elegant external sorting
Hello haskell-cafe, SPJ asked us a few years ago about examples of simple and elegant haskell programs. i want to propose this external sorting program: it reads stdin in chunks of 5000 lines, writes sorted chunks into files and then merges files together: import Data.List import Control.Monad import Control.Arrow main = do -- (Lazily) create sorted sublists sublists - fmap chop_and_sort getContents -- Write the sublists into files named 1..n n - fmap length $ zipWithM writeFile (map show [1..]) sublists -- Read (again lazily) contents of these files sublists - mapM (fmap lines.readFile.show) [1..n] -- Merge them and write result to stdout putStr (unlines (merge_lists compare sublists)) -- Split input list into 5000-line chunks and sort them chop_and_sort = lines recursive (splitAt 5000) map (sortunlines) -- unfoldr variant that stops on empty list recursive splitFunc = unfoldr (\xs - guard (xs[]) Just (splitFunc xs)) -- Merging sorted lists (kidnapped from Data.List) merge_lists :: (a - a - Ordering) - [[a]] - [a] merge_lists cmp [] = [] merge_lists cmp [xs] = xs merge_lists cmp xss = merge_lists cmp (merge_pairs cmp xss) merge_pairs :: (a - a - Ordering) - [[a]] - [[a]] merge_pairs cmp [] = [] merge_pairs cmp [xs] = [xs] merge_pairs cmp (xs:ys:xss) = merge cmp xs ys : merge_pairs cmp xss merge :: (a - a - Ordering) - [a] - [a] - [a] merge cmp xs [] = xs merge cmp [] ys = ys merge cmp (x:xs) (y:ys) = case x `cmp` y of GT - y : merge cmp (x:xs) ys _ - x : merge cmpxs (y:ys) -- Best regards, Bulat mailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Haskell mode for Emacs question
Hello John, Thursday, January 22, 2009, 8:50:39 PM, you wrote: thanks, support of over-internet and intranet collaboration looks very promising these days (even if not saying about ability to highlight error place ;) btw, i was unable to download mp4 video from http://vimeo.com/1653402 (online players doesn't work in my browser) Not that you're looking to switch editors, but if you want something a little more hassle-free: http://www.n-brain.net/unashots/Haskell/ErrorHighlighting.png Regards, John On Jan 22, 2009, at 10:17 AM, Peter Verswyvelen wrote: I have a silly problem. I'm using Emacs with the Haskell mode extension on Windows I have a source file in say c:/foo/src/main.hs main.hs is importing some other modules in that same src directory When I invoke GHCi from within Emacs, the first thing it does is :cd c:/foo and then :load src/main.hs But of course GHCi won't find the imported modules now, since the current directory is wrong. If I type in GHCi :cd src :load main.hs then it compiles fine. Does anyone have an idea why Emacs or the Haskell mode is switching to the parent directory of src instead of src itself, and how to fix this? Thanks a lot, Peter ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Question about allocaArray and friends
Hello Patrick, Friday, January 23, 2009, 1:22:21 AM, you wrote: In C, if you try to alloca too much memory, then the stack gets overwritten and bad things happen. Does GHC exhibit the same behavior with allocaArray and the like? Is there a way to find out how much is safe to allocate? alloca allocs memory in heap, so it should be safe if you are not going to allocate lots of megabytes. you can use usual binary division algorithm to find how much you can allocate -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Functors [Comments from OCaml Hacker Brian Hurt]
Hello Luke, Saturday, January 17, 2009, 3:16:06 PM, you wrote: fmap id = id fmap (f . g) = fmap f . fmap g The first property is how we write preserving underlying structure, but this has a precise, well-defined meaning that we can say a given functor obeys or it does not (and if it does not, we say that it's a bad instance). But you are correct that Haskell does not allow us to require proofs of such properties. not haskell itself, but QuickCheck allows. we may even consider lifting these properties to the language level -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt
Hello david48, Friday, January 16, 2009, 4:16:51 PM, you wrote: Upon reading this thread, I asked myself : what's a monoid ? I had no idea. I read some posts, then google haskell monoid. it would be interesting to google C++ class or Lisp function and compare experience :) -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What could be considered standard Haskell these days?
Hello Mauricio, Friday, January 16, 2009, 5:00:58 PM, you wrote: So: if someone wants to learn the details of the language, what could be the subset of extensions one should learn and make regular use, and also include in code supposed to be used by others in the long term? probably Haskell-prime is the best guiding line now historically, this pretty standard Haskell is a common subset of hugs and ghc extensions. but even this subset is a bit too large, containing some temporary and not much beloved extensions (parallel comprehensions, fundeps...) -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] ANN: HTTPbis / HTTP-4000.x package available
Hello Sigbjorn, Friday, January 16, 2009, 5:42:06 PM, you wrote: first question: are these packages (http, curl, curl-shell, webclient) windows-compatible? second - that is advantages of using http (or webclient) over curl? sorry if questions are stupid - i'm pretty ignorant here :) Thanks Jeff, regarding having to use both HTTP and cURL -- or perhaps only the latter for code simplicitly -- that will probably remain the case for quite a while still. To help with that situation, I put together an over-arching 'webclient' library that abstracts over the transport layers (HTTP, curl, curl-shell) giving you an API that's consistent across backends. I could release that at some point if there's sufficient interest.. It also adds WebDAV support. Re: curl - as an author of the 'curl' package, I'm also keen on finding ways of making that better -- both in terms of using the underlying lib functionality and API on the Haskell side. Suggestions/contribs most welcome. Ditto for HTTP too, of course :) --sigbjorn On 1/16/2009 05:47, Jeff Heard wrote: Just as a reported speedup, downloading a 5MB file from my own local machine (via http) went from 1.05 secs to 0.053 secs. Yes, it's really an order of magnitude better. Performance now is on par or slightly better than cURL (however to get more protocols than HTTP, you'll still need the ubiquitous cURL library) On Fri, Jan 16, 2009 at 1:36 AM, Sigbjorn Finne sigbjorn.fi...@gmail.com wrote: Hi, I guess it's time to publish more widely the availability of a modernization of the venerable and trusted HTTP package, which I've been working on offon for a while. Bunch of changes, but the headline new feature of this new version is the parameterization of the representation of payloads in both HTTP requests and responses. Two new representations are supported, strict and lazy ByteStrings. Some people have reported quietly pleasing speedups as a result of this change. (If they want to report numbers, please do..) Another change/fix in this release is the _alleged_ fix to the long-standing bug in the use of absolute URIs vs absolute paths in requests (for non-proxied and proxied use.) Give it a go.. Notice that the HTTP-4000.x version will require you to make some modifications to your existing HTTP-using code -- I've tried to keep the API backwards compatible minimal despite the change in functionality and underlying types. If you do not want to deal with this right away, please introduce a 4000 dependency on the HTTP package in your .cabal files. I've also taken on the maintainership of the package, with the highly esteemed Bjorn Bingert no longer having the usual abundance of cycles to look after it (hope I'm not misrepresenting facts here, Bjorn!) However, I've yet to gain access to www.haskell.org and update http://www.haskell.org/http, so for now you may pick up a new version the lib via http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HTTP GIT repo for HTTP-4000 / HTTPbis is here git://code.galois.com/HTTPbis.git enjoy --sigbjorn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re: Haskell and C++ program
Hello Eugene, Thursday, January 15, 2009, 3:27:59 PM, you wrote: but at least length.map show is eq to length :) Well, your program is not equivalent to the C++ version, since it doesn't bail on incorrect input. 2009/1/15 Apfelmus, Heinrich apfel...@quantentunnel.de: Jonathan Cast wrote: reverseDouble = unlines . intro . map show . reverse . map (read :: String - Double) . takeWhile (/= end) . words where intro l = (read ++ show (length l) ++ elements) : elements in reversed order : l This can be simplified to ... . map show . reverse . map read . ... = { map f . reverse = reverse . map f } ... . reverse . map show . map read . ... = { map f . map g = map (f . g) } ... . reverse . map (show . read) . ... = { show . read = id } ... . reverse . map id . ... = { map id = id } ... . reverse . ... In other words, reverseDouble = unlines. intro . reverse . takeWhile (/= end) . words where intro xs = (read ++ show (length xs) ++ elements) : elements in reversed order : xs And the doubles disappeared completely. :) Regards, H. Apfelmus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Haskell and C++ program
Hello Jonathan, Thursday, January 15, 2009, 1:41:23 AM, you wrote: reverseDouble = unlines . intro . map show . reverse . map (read :: String - Double) . takeWhile (/= end) . words using arrows, this may be reversed: reverseDouble = words takeWhile (/= end) ... I observe also in passing that the cast on read is somewhat inelegant; in a real application, the consumer of map read's output would specify its type sufficiently that the cast would be un-necessary. in small scripts explicit read casts are rather common -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re: Monads aren't evil
Hello Miguel, Sunday, January 11, 2009, 7:06:54 PM, you wrote: I believe it was Bulat Ziganshin who once proposed parsing x + y*z + t as x + (y * z) + t and x + y * z + t as (x + y) * (z + t) x+y * z+t should be here -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Looking for Haskellers on Windows
Hello Günther, Saturday, January 10, 2009, 5:31:13 PM, you wrote: i think that problem is not shortage of windows developers among haskellers, but shortage of db developers :) Hi Bulat, I do :), but I was amazed that there was no response to a post with, what I thought, would be a rather common problem for an application developer. That post was about writing to an MS-Access database via HDBC-ODBC, which fails. When I then asked the HDBC maintainer himself it turned out that he doesn't use Windows either and thus can't help. Thus my cry for help explicitly to Haskellers on Windows. Günther Am 10.01.2009, 15:18 Uhr, schrieb Bulat Ziganshin bulat.zigans...@gmail.com: Hello Günther, Saturday, January 10, 2009, 5:03:18 PM, you wrote: there are lot of windows haskellers so you can just write your questions in haskell-cafe Hi all, I'm looking for Haskell programmer that use Windows as their OS-Plattform. I developing an application in Haskell on Windows and run into problems that seem to have a lower priority with the greater Haskell community as most of them are using Linux where the problems do not occur or are already solved. So it'd be nice to get in touch with other Haskellers that face the same problems. Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Computer time, independent of date
Hello Mauricio, Friday, January 9, 2009, 4:01:18 PM, you wrote: computer has been turned on would do all I need. Or, maybe, how much has elapsed since the program started. i think you should look into system counters (if you on windows). for example, task managet in vista shows time since reboot, i think that in registry it should be available in previous windowses too. at the cpu level, there is cpu ticks counter, it should be readable via special libraries -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re: Computer time, independent of date
Hello Cetin, Friday, January 9, 2009, 4:29:04 PM, you wrote: yes, i mean this lib but forget its name :) thank you Don't know if it might help but: http://en.wikipedia.org/wiki/RDTSC cabal install rdtsc http://hackage.haskell.org/packages/archive/rdtsc/1.1.1/doc/html/System-CPUTime-Rdtsc.html Regards, CS 2009/1/9 Bulat Ziganshin bulat.zigans...@gmail.com Hello Mauricio, Friday, January 9, 2009, 4:01:18 PM, you wrote: computer has been turned on would do all I need. Or, maybe, how much has elapsed since the program started. i think you should look into system counters (if you on windows). for example, task managet in vista shows time since reboot, i think that in registry it should be available in previous windowses too. at the cpu level, there is cpu ticks counter, it should be readable via special libraries -- Best regards, Bulat mailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell] Re: [Haskell-cafe] ANNOUNCE: haskell-src-exts 0.4.8
Hello Max, Friday, January 9, 2009, 4:15:48 AM, you wrote: Otherwise, Notepad++ appears to have Unicode support. even notepad (on my vista box) supports utf-8, utf16be and utf16le :))) -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Blitting one IOUArray into another
Hello Denis, Wednesday, January 7, 2009, 6:56:36 PM, you wrote: memory allocated for i :))) each new copy of i needs one word. the situation was much worse with Int64, of course :) Hi all, I'm seeing a lot of unexpected memory allocation with some simple code that copies the contents of one vector (IOUArray Int Int64) into another of the same type and dimensions. In particular, profiling reveals that `copyInto' is allocating oodles and oodles of memory. My small test case creates two 5-element arrays and performs 1 copies from one into the other. Since the elements are Int64s and the arrays are unboxed, each array should be 5 elements * 8 bytes per element = 400,000 bytes and so the arrays should only take 800,000 bytes total. I understand there's some overhead for thunks and whatnot, but the profiler reported allocation is around 40 billion bytes. And almost all of that allocation is in my copying function, not in main (main allocates the arrays). I've attached two versions of the code, just for comparison. The only difference is the way the copying is done. One calls `getBounds' to figure out the bounds, and one is given the bounds for copying. They're both about the same speed and allocation (originally I was using IOUArray Int64 Int64, and there was a much greater allocation difference between the two versions; but that went away. Oh well). So, does anyone know why copying takes so much allocation? I expect there is _some_ way to just move memory from one array to another, like a memcpy -- how can I do that? Denis -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] pattern matching on date type
Hello Max.cs, Thursday, January 1, 2009, 11:36:24 AM, you wrote: seems that you come from dynamic languages :) Haskell has static typing meaning that your function can accept either Tree or a as arguments. so you should convert a to Tree explicitly, using Leaf thanks! suppose we have data Tree a = Leaf a | Branch (Tree a) (Tree a) deriving Show and how I could define a function foo :: a - Tree a that foo a = Leaf a where a is not a type of Tree foo b = b where b is one of the type of Tree (Leaf or Branch) ? The following code seems not working.. foo (Leaf a) = a foo a = Leaf a saying 'Couldn't match expected type `a' against inferred type `Btree a'' any idea? Thanks, Max From: Brandon S. Allbery KF8NH Sent: Thursday, January 01, 2009 7:35 AM To: Max.cs Cc: Brandon S. Allbery KF8NH ; beginn...@haskell.org ; haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] definition of data On 2009 Jan 1, at 2:32, Max.cs wrote: data Tree a = a | Branch (Tree a) (Tree a)deriving Show but it seems not accpetable in haskell ? You need a constructor in both legs of the type: data Tree a = Leaf a | Branch (Tree a) (Tree a) deriving Show -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cross compiling from Linux to windows?
Hello Erik, Monday, December 29, 2008, 2:31:40 AM, you wrote: ghc doesn't support cross-compilation I've googled for this but haven't really found an answer yet. Is it possible to build (or better yet download) a GHC compiler that runs on Linux and generates windows binaries? I already use the MinGW C compiler to generate windows binaries from C code and I run my test suite under WINE. This has been working very well for me for some time and now I'd like to do the same for Haskell code. Cheers, Erik -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Timing difference
Hello Aai, Thursday, December 25, 2008, 11:45:33 AM, you wrote: remarkable (that's to say: for me) difference in timing using lambda function in the one case and point free in the other. Timing was measured in GHCi. Compiled there's no difference! compiler optimizes program, replacing slower version with faster one. ghci executes code exactly -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Trouble with the ST monad
Hello Andre, Monday, December 22, 2008, 4:44:34 AM, you wrote: Is there any difference between using freeze/thaw from Data.Array.MArray versus freezeSTArray/thawSTArray from GHC.Arr? portability, at least -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re: Threads with high CPU usage
Hello Günther, Monday, December 22, 2008, 1:57:22 AM, you wrote: try -threaded, +RTS -N2, and forkOS simultaneously. it may work - i don't see reasons why other threads should be freezd why one does unsafe call nother solution is to compile library with unsafe call changed to safe. this change is always safe but make call ~10mcs slower :) Hi Mads, I just noticed that too. I had been wondering why this problem does not occur with the sample app from RWH eventhough I was employing the same technics as they did. It just occured to me that all the DB interactions in their app are fairly short and thus the problem never becomes apparent. Thanks everyone, I was going crazy here, couldn't figure out what I was doing wrong. Would anyone happen to know of a safe alternative to HDBC? Günther Am 21.12.2008, 23:39 Uhr, schrieb Mads Lindstrøm mads_lindstr...@yahoo.dk: Hi Günther, Hi Mads, I'm using HDBC with sqlite3 Looking at http://software.complete.org/software/repositories/entry/hdbc-sqlite3/Database/HDBC/Sqlite3/Connection.hs and http://software.complete.org/software/repositories/entry/hdbc-sqlite3/Database/HDBC/Sqlite3/Statement.hsc you can see that HDBC-sqlite's foreign calls are indeed marked unsafe. /Mads Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re: Threads with high CPU usage
Hello John, Monday, December 22, 2008, 5:15:46 PM, you wrote: And in general we would not even bother with considering using unsafe for calls that are already expensive. It's only worth considering when the length of the call is always very short. the other way to look at it is to measure overhead of safe call. on 1 GHz Duron i measured 66.000 calls of trivial safe function per second, meaning 16.000 cpu ticks per call (ghc 6.8). it's rather large overhead for many trivial functions, but for calls to sql engine it seems rather small -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re: Threads with high CPU usage
Hello Alistair, Monday, December 22, 2008, 7:28:03 PM, you wrote: safe). I also was not aware of unsafe calls blocking other threads. they don't to it directly. but without -threaded +RTS -N (or forkOS) there is only 1 OS thread that runs all haskell threads. unsafe call blocks it untill call finished, while safe call allows to reuse it for other haskell threads execution. i've attached old ghc commentary on this topic, although things may be significantly changed ATM -- Best regards, Bulatmailto:bulat.zigans...@gmail.com The GHC Commentary - Supporting multi-threaded interoperation.htm Description: Binary data ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] concurrent haskell: thread priorities
Hello Neal, Monday, December 22, 2008, 11:07:32 PM, you wrote: The threaded RT creates an OS thread for each CPU/core on the system and uses them to multiplex userland threads. These are context switched whenever they block/yield/gc and no priorities can be assigned. not exactly. amount of OS threads created controlled by +RTS -N option to the program; unless program has special function that RTS calls to set up this value they are switched on every minor GC which by default occurs after each 256kb allocated which is rather frequent event It seems like we could get some priority based scheduling (and still be slackers) if we allow marked green threads to be strictly associated with a specific OS thread (forkChildIO?). forkOS creates new haskell thread and new OS thread specially for it -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re: [Haskell] ANN: HLint 1.0
Hello Martijn, Saturday, December 20, 2008, 4:38:10 PM, you wrote: Why not: (4 == length TAG ) (TAG `isPrefixOf` just_name pinfo) I assume the (==) referred to in the name of the fix is the one in the suggestion. Why doesn't the suggestion come with the check removed? I.e.: due to Turing computability problem, i believe :) although Neil may try to run it in separate thread :) -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Beginner's TH question
Hello Jeff, Saturday, December 20, 2008, 6:59:42 PM, you wrote: my experience tells that you should insert whole language sentences, like $(add_fields [d| data T = T { myfield :: Field, ... } ] ) where original declaration passed as a parameter Two things... can I add fields to records using Template Haskell, like: data T = T { $fields, myfield :: Field, ... } I assume the answer there is no, and then what's wrong with this? I get: Illegal instance declaration for `UIState t' (All instance types must be of the form (T a1 ... an) where a1 ... an are type *variables*, and each type variable appears at most once in the instance head. Use -XFlexibleInstances if you want to disable this.) In the instance declaration for `UIState t' In the expression: [d| instance UIState t where { setSizeY v a = setSizeY v . uist $ a setSizeX v a = setSizeX v . uist $ a setDrawing v a = setDrawing v . uist $ a setKey v a = setKey v . uist $ a } |] In the definition of `deriveUIState': deriveUIState uist t = [d| instance UIState t where { setSizeY v a = setSizeY v . uist $ a setSizeX v a = setSizeX v . uist $ a setDrawing v a = setDrawing v . uist $ a } |] in this module: -# LANGUAGE TemplateHaskell #-} module Graphics.Rendering.Thingie.TH where import Language.Haskell.TH import Graphics.Rendering.Thingie.UIState import qualified Graphics.Rendering.Thingie.BasicUIState as S deriveUIState uist t = [d| instance UIState t where mousePosition a = S.mousePosition . uist $ a mouseLeftButtonDown a = S.mouseLeftButtonDown . uist $ a mouseRightButtonDown a = S.mouseRightButtonDown . uist $ a mouseMiddleButtonDown a = S.mouseMiddleButtonDown . uist $ a mouseLeftButtonClicked a = S.mouseLeftButtonClicked . uist $ a mouseRightButtonClicked a = S.mouseRightButtonClicked . uist $ a mouseMiddleButtonClicked a = S.mouseMiddleButtonClicked . uist $ a mouseWheel a = S.mouseWheel . uist $ a keyCtrl a = S.keyCtrl . uist $ a keyShift a = S.keyShift . uist $ a keyAlt a = S.keyAlt . uist $ a key a = S.key . uist $ a drawing a = S.drawing . uist $ a sizeX a = S.sizeX . uist $ a sizeY a = S.sizeY . uist $ a setMousePosition v a = setMousePosition v . uist $ a setMouseLeftButtonDown v a = setMouseLeftButtonDown v . uist $ a setMouseRightButtonDown v a = setMouseRightButtonDown v . uist $ a setMouseMiddleButtonDown v a = setMouseMiddleButtonDown v . uist $ a setMouseLeftButtonClicked v a = setMouseLeftButtonClicked v . uist $ a setMouseRightButtonClicked v a = setMouseRightButtonClicked v . uist $ a setMouseMiddleButtonClicked v a = setMouseMiddleButtonClicked v . uist $ a setMouseWheel v a = setMouseWheel v . uist $ a setKeyCtrl v a = setKeyCtrl v . uist $ a setKeyShift v a = setKeyShift v . uist $ a setKeyAlt v a = setKeyAlt v . uist $ a setKey v a = setKey v . uist $ a setDrawing v a = setDrawing v . uist $ a setSizeX v a = setSizeX v . uist $ a setSizeY v a = setSizeY v . uist $ a |] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Coroutines
Hello Miguel, Thursday, December 18, 2008, 1:42:21 PM, you wrote: ruby doesn't support coroutines, but only iterators (where control moved from caller to callee). usually control is on the caller side, and coroutines gives control to both (or many) sides coroutines are easily emulated in IO monad using multithreading, and i think that are easily emulated both in Ruby and Haskell using callCC First thing I've tried when learning Ruby was something like that: def a yield {puts 1} end a {yield} It didn't work. Can Coroutine.hs do something like that? On 18 Dec 2008, at 13:26, Ryan Ingram wrote: On Thu, Dec 18, 2008 at 2:00 AM, Nicolas Pouillard nicolas.pouill...@gmail.com wrote: I don't see why one would need session types, channels... to express that. I maybe need a more complicated coroutines (ruby) example that would require using this system. OK, how would you type these routines in Haskell? def simple yield hello yield 1 yield (lambda { |x| x + 1 }) end def useSimple state = 0 result = nil simple { |x| if (state == 0) then result = x else if (state == 1) then result += (x * 4).toString else if (state == 2) then result += x.call(10).toString state = state + 1 } result end I know it's a bit contrived, but you get the idea. In Haskell using Control.Coroutine: simple :: forall rest. Session (String :!: Int :!: (Int - Int) :!: rest) rest () simple = do put hello put 1 put (\x - x + 1) useSimple :: forall rest. Session (String :?: Int :?: (Int - Int) :?: rest) rest String useSimple = do string - get int - get func - get return (string ++ show (int * 4) ++ show (func 10)) result :: String result = snd $ connects simple useSimple -- result = hello411 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[4]: [Haskell-cafe] Coroutines
Hello Brandon, Thursday, December 18, 2008, 7:05:05 PM, you wrote: ruby doesn't support coroutines, but only iterators (where control moved from caller to callee). usually control is on the caller side, and coroutines gives control to both (or many) sides Right, and you don't normally do iterators in Haskell; you do map/fmap. iterators are not cycles :) they allow to return value without returning control -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Threads not running under GHC 6.10?
Hello Simon, Wednesday, December 17, 2008, 4:05:48 PM, you wrote: I'm afraid the underlying problem is one that GHC has always had - that we can't preempt threads that aren't allocating. It's not easily fixable, we would have to inject dummy heap checks into every non-allocating loop, which would seriously hurt performance for those tight loops. just technical note - if we unroll such loops and insert one check per 10 repetitions, it may be ok. although conditional execution may be a problem for such solution -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Memoization-question
Hello Daniel, Thursday, December 11, 2008, 11:09:46 PM, you wrote: you is almost right. but ghc don't share results of function calls despite their type. it just assumes that value of any type may use a lot of memory even if this type is trivial :) example when automatic sharing is very bad idea is: main = print (sum[1..10^10] + sum[1..10^10]) Am Donnerstag, 11. Dezember 2008 16:18 schrieb Mattias Bengtsson: The program below computes (f 27) almost instantly but if i replace the definition of (f n) below with (f n = f (n - 1) * f (n -1)) then it takes around 12s to terminate. I realize this is because the original version caches results and only has to calculate, for example, (f 25) once instead of (i guess) four times. There is probably a good reason why this isn't caught by the compiler. But I'm interested in why. Anyone care to explain? main = print (f 27) f 0 = 1 f n = let f' = f (n-1) in f' * f' (compiled with ghc --make -O2) Mattias Not an expert, so I may be wrong. The way you wrote your function, you made it clear to the compiler that you want sharing, so it shares. With g 0 = 1 g n = g (n-1)*g (n-1) it doesn't, because the type of g is Num t = t - t, and you might call it with whatever weird Num type, for which sharing might be a bad idea (okay, for this specific function I don't see how I would define a Num type where sharing would be bad). If you give g a signature like g :: Int - Int, the compiler knows that sharing is a good idea and does it (cool thing aside: with module Main where f 0 = 1 f n = let a = f (n-1) in a*a main = do print (f 27) print (g 30) g 0 = 1 g n = g (n-1)*g (n-1) main still runs instantaneously, but g n takes exponential time at the ghci prompt. That's because in main the argument of g is defaulted to Integer, so it's shared.) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Memoization-question
Hello Daniel, Thursday, December 11, 2008, 11:49:40 PM, you wrote: sorry fo r noise, it seems that i know ghc worse than you Am Donnerstag, 11. Dezember 2008 21:11 schrieb Bulat Ziganshin: Hello Daniel, Thursday, December 11, 2008, 11:09:46 PM, you wrote: you is almost right. but ghc don't share results of function calls despite their type. it just assumes that value of any type may use a lot of memory even if this type is trivial :) I may misunderstand you here. But if you give a type signature specifying a nice known type, I'm pretty sure ghc _does_ sharing (tried with Int - Int and Integer - Integer, g 200 instantaneous), at least with -O2. Without sharing, it would require 2^(n+1) - 1 calls to evaluate g n, that wouldn't be nearly as fast. Without the type signature, it must assume the worst, so it doesn't share. example when automatic sharing is very bad idea is: main = print (sum[1..10^10] + sum[1..10^10]) Depends on what is shared. Sharing the list would be a very bad idea, sharing sum [1 .. 10^10] would probably be a good idea. Am Donnerstag, 11. Dezember 2008 16:18 schrieb Mattias Bengtsson: The program below computes (f 27) almost instantly but if i replace the definition of (f n) below with (f n = f (n - 1) * f (n -1)) then it takes around 12s to terminate. I realize this is because the original version caches results and only has to calculate, for example, (f 25) once instead of (i guess) four times. There is probably a good reason why this isn't caught by the compiler. But I'm interested in why. Anyone care to explain? main = print (f 27) f 0 = 1 f n = let f' = f (n-1) in f' * f' (compiled with ghc --make -O2) Mattias Not an expert, so I may be wrong. The way you wrote your function, you made it clear to the compiler that you want sharing, so it shares. With g 0 = 1 g n = g (n-1)*g (n-1) it doesn't, because the type of g is Num t = t - t, and you might call it with whatever weird Num type, for which sharing might be a bad idea (okay, for this specific function I don't see how I would define a Num type where sharing would be bad). If you give g a signature like g :: Int - Int, the compiler knows that sharing is a good idea and does it (cool thing aside: with module Main where f 0 = 1 f n = let a = f (n-1) in a*a main = do print (f 27) print (g 30) g 0 = 1 g n = g (n-1)*g (n-1) main still runs instantaneously, but g n takes exponential time at the ghci prompt. That's because in main the argument of g is defaulted to Integer, so it's shared.) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Translating RWH into other languages
Hello Don, There is a team of people which want to translate RWH book into Russian. is it ok? can you help us by establishing subversion of RWH book on your site. if it will contain copy of the English book for the beginning and allow team members to further edit it - it will be great! -- Best regards, Bulat mailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Why does instance Ord Pat causes loop
Hello Martin, Monday, December 8, 2008, 12:04:06 PM, you wrote: Now it took me about a week to realise, that 'instance Ord Pat' causes ghc to loop. naive Ord instance Ord Exp instance Ord Pat i think you just don't learned this part of Haskell. empty instance declarations like these are possible but they doesn't mean automatic definition of some suitable compare. they just bring in some default definitions which may be mutual recursive, such as (==) and (/=) definitions in Eq class. this is intended to that your define either (==) or (/=), but compiler doesn't check this, so if you don't define anything, you will get endless loop if you want compiler to infer automatic instance definitions, the only way is to use GHC extension, smth like deriving instance Ord for Pat -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Gluing pipes
Hello Stefan, Friday, December 5, 2008, 8:35:18 PM, you wrote: \ x y - f (g x) (h y) [...] f $. g ~ h ~ id I keep help wonder: other than a 5 chars, what is it we have gained? Haskell programmers would be paid more :D -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] handles and foreign C functions
Hello Andrea, Wednesday, December 3, 2008, 5:09:21 PM, you wrote: How can I pass to printStuff a stdout FILE pointer? afair, stdout syntax used to import variables. it was discussed just a day or two ago :) -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] gmp license == no commercial/closed source haskell software ??
Hello Don, Wednesday, December 3, 2008, 5:36:57 PM, you wrote: From my understanding, the gmp is GPL, GHC statically links it on windows. GMP is *LGPL*. Supporting this is trivial with a dynamically linked / DLL libgmp. the whole problem is that it links in statically, that reduces license to GPL -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] handles and foreign C functions
Hello Andrea, Wednesday, December 3, 2008, 7:23:20 PM, you wrote: either some error in the code (i neevr used this feature) or stdout may be defile by a macro. can you try to define function for it: FILE *out() {return stdout;} On Wed, Dec 03, 2008 at 07:08:00PM +0300, Bulat Ziganshin wrote: Hello Andrea, Wednesday, December 3, 2008, 5:09:21 PM, you wrote: How can I pass to printStuff a stdout FILE pointer? afair, stdout syntax used to import variables. it was discussed just a day or two ago :) you mean this, I think: foreign import ccall unsafe stdout c_stdout :: Ptr CFile (my fault with the cutpaste of the previous message). This is causing the segmentation fault I was talking about. Thanks, Andrea ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] import
Hello Vasili, Tuesday, December 2, 2008, 2:08:03 PM, you wrote: it's just convention to make modules like this: module System.Stream ( module System.Stream.Class, module System.Stream.Transformer, module System.Stream.Instance, module System.Stream.Utils, ) where import System.Stream.Class import System.Stream.Transformer import System.Stream.Instance import System.Stream.Utils specifically I am concerned about ByteString and underlying nodes .. ??? On Tue, Dec 2, 2008 at 3:45 AM, Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Vasili, Tuesday, December 2, 2008, 11:48:40 AM, you wrote: I am a little uncertain about import semantics in a hierarchical package ... i.e. if I import the root of a package root do I get everything under the root's namespace, i.e. the namespace tree? no. you import just *module*, and it gives you just the identifiers exported by module (by default - all symbols *defined* in this module) -- Best regards, Bulat mailto:[EMAIL PROTECTED] -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] import
Hello Vasili, Tuesday, December 2, 2008, 11:48:40 AM, you wrote: I am a little uncertain about import semantics in a hierarchical package ... i.e. if I import the root of a package root do I get everything under the root's namespace, i.e. the namespace tree? no. you import just *module*, and it gives you just the identifiers exported by module (by default - all symbols *defined* in this module) -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] GHC on Fedora 10 - getMBlock: mmap: Permission denied
Hello Fraser, Tuesday, December 2, 2008, 6:34:19 PM, you wrote: search in GHC tracker: afair there was some SELinux-releated report Why didn't that occur to me? I should get more sleep. Thanks for the tip. Now I know that it definitely is SELinux, a system I understand not at all, I presume the problem is in these context things ... ghc has system_u and bin_t, while audley has unconfined_u and file_t. Time to go poking about. The unconfined_u looks suspicious. cheers, Fraser. On Tue, Dec 2, 2008 at 3:48 PM, David Leimbach [EMAIL PROTECTED] wrote: Did you try turning off SELinux to check? 2008/12/2 Fraser Wilson [EMAIL PROTECTED] Hi all, Has anybody seen this? I thought it might be an SELinux thing, but then I wouldn't expect GHC or darcs to run. Audley is a fairly simple program in operating system feature terms, but I get the same error with anything I build myself. [EMAIL PROTECTED] audley]$ ./dist/build/audley/audley audley: internal error: getMBlock: mmap: Permission denied (GHC version 6.8.3 for i386_unknown_linux) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug Aborted [EMAIL PROTECTED] audley]$ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.8.3 [EMAIL PROTECTED] audley]$ cat /proc/version Linux version 2.6.27-0.352.rc7.git1.fc10.i686 ([EMAIL PROTECTED]) (gcc version 4.3.2 20080917 (Red Hat 4.3.2-4) (GCC) ) #1 SMP Tue Sep 23 21:26:04 EDT 2008 [EMAIL PROTECTED] audley]$ cheers, Fraser. -- http://thewhitelion.org/mysister ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] ANN: Real World Haskell, now shipping
Hello Jason, Saturday, November 29, 2008, 5:55:06 PM, you wrote: It seems to be an unwritten law that any package involving non-Haskell components doesn't work on Windoze. Well, I'll have a chance to verify this soon enough. Have you posted your errors somewhere? unfortunately, HsLua already breaks the law :) -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[4]: [Haskell-cafe] ANN: Real World Haskell, now shipping
Hello Duncan, Saturday, November 29, 2008, 7:49:52 PM, you wrote: It seems to be an unwritten law that any package involving non-Haskell components doesn't work on Windoze. unfortunately, HsLua already breaks the law :) How so? it has C code and works on windows -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re: Go Haskell! - array libraries
Hello Andrew, Saturday, November 29, 2008, 9:23:29 PM, you wrote: This goes beyond array libraries; do you have any idea how many binary packages there are? i wrote 3 :))) -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Compilers
Hello Daniel, Sunday, November 30, 2008, 1:41:03 AM, you wrote: Yes, that's very nice to be able to just type $ cabal update $ cabal install whatever and cabal automatically takes care of dependencies (unfortunately only Haskell i have to mention that there are no haskell compilers that work this way. may be this say something important about Cabal? ;) -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Using Parsec with other monads
Hello Roly, Saturday, November 29, 2008, 2:27:22 AM, you wrote: Now it seems I can't actually do that in a nice way because Parsec appears to be fixed to a simple State monad. afaik, version 3 is implemented as monad transformer -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Need machine for DPH benchmarking
Hello Daniel, Thursday, November 27, 2008, 4:43:08 PM, you wrote: Another possibility is using the Amazon EC2 functionality and rent a high-CPU instance (http://aws.amazon.com/ec2/#instance) for as long as these are virtual cores, which isn't appropriate for measuring performance on real 4/8 core boxes -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] workarounds for Codec.Compression.Zlib errors in darcs
Hello Duncan, Thursday, November 27, 2008, 1:28:21 AM, you wrote: checking mode rather than in a generating mode. It would use much of the same code as c2hs but it would read the C header files and the .hs file (via ghc api) and check that the FFI imports are using the right types. there is FFI imports generator (HSFFIG?), written by Dmitry Golubovsky -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Windows vs. Linux x64
Hello Don, Tuesday, November 25, 2008, 1:59:02 AM, you wrote: Is Windows running in 32 bit? What gcc versions are you using on each system? there is no 64-bit ghc for windows yet, and i think that 64-bit windows runs 32-bit programs as fast as 32-bit windows this problem naturally splits into two parts: 32-bit vs 64-bit and linux vs windows -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Data.Array.Storable vs GC
Hello David, Tuesday, November 25, 2008, 4:45:28 PM, you wrote: However, I am getting very poor performance due to the GC copying 6G in each run. The only explanation that I can think of is that it is copying my giant array. each GC run? each program run? try to increase size of your array and check how many data are now copied by GC (of course, everything else shouldn't be changed) it's possible that your code that fills an array creates a lot of intermediate data -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Data.Array.Storable vs GC
Hello David, Tuesday, November 25, 2008, 5:27:51 PM, you wrote: When I was researching how to do this, I was really hoping for something like static areas from the Lisp Machine operating system. You could allocate any normal object in an area of the heap where the GC would not bother with it. I miss that. I wonder why GHC doesn't have such a concept? it has. bytestrings use this area, it's called pinned arrays -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[4]: [Haskell-cafe] Password hashing
Hello Thomas, Tuesday, November 25, 2008, 6:39:27 PM, you wrote: Just to note, the comment about md5 is incorrect. I switched to SHA512 as you can see in the code. really? :) Right s - -- return . show . md5 . L.pack $ p ++ s typical salt usage is generation of new salt for every encryption operation and storing together with encrypted data -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[6]: [Haskell-cafe] Password hashing
Hello Thomas, Tuesday, November 25, 2008, 9:13:53 PM, you wrote: don't reinvent the wheel, use PBKDF2 from PKCS #5 http://www.truecrypt.org/docs/pkcs5v2-0.pdf How about the following? The main doubts I'm having at this point concern the takerandom part. Does this seem reasonable? Also, someone in the thread mentioned that a calculation that took a couple of seconds to complete was a good thing because it makes dictionary cracking harder. But makeSaltedPasswordLinux meh is virtually instantaneous, so I guess I'm doing something wrong? Thanks for advice! thomas. [EMAIL PROTECTED]:~/hackage/HAppSHelperscat HAppS/Helpers/Security.hs -- | Password hashes are based on a salt from a source of randomness (eg /dev/urandom), and -- | the SHA512 hashing function module HAppS.Helpers.Security ( makeSaltedPassword, makeSaltedPasswordLinux, checkpass ) where import qualified Data.ByteString.Char8 as B import qualified Data.ByteString as B' import Control.Monad.Error import System.IO.Error import Random import Data.Digest.SHA512 (hash) import Data.Char data SaltedPassword = SaltedPassword HashedPass Salt deriving Show newtype Password = Password String deriving Show newtype Salt = Salt String deriving Show newtype HashedPass = HashedPass String deriving (Eq, Show) checkpass :: Password - SaltedPassword - Bool checkpass passattempt ( SaltedPassword hashedPass salt ) = let hashedPassAttempt = hashpass passattempt salt in hashedPassAttempt == hashedPass hashpass :: Password - Salt - HashedPass hashpass (Password p) (Salt s) = HashedPass . B.unpack . B'.pack . hash . B'.unpack . B.pack $ p ++ s -- | This works at least on ubuntu hardy heron, I don't know how portable it is -- makeSaltedPasswordLinux p = getSaltedPassword $ readFile /dev/urandom) makeSaltedPasswordLinux :: Password - IO SaltedPassword makeSaltedPasswordLinux = makeSaltedPassword $ readFile /dev/urandom makeSaltedPassword :: IO String - Password - IO SaltedPassword makeSaltedPassword randomsource pass = do etR - try $ return . takerandom = randomsource case etR of Left e - fail . show $ e Right s - do let salt = Salt s hp = hashpass pass salt return $ SaltedPassword hp salt takerandom :: String - String takerandom = show . fst . next . mkStdGen . read . concat . map (show . ord) . take 1000 2008/11/25 Bulat Ziganshin [EMAIL PROTECTED]: Hello Thomas, Tuesday, November 25, 2008, 6:39:27 PM, you wrote: Just to note, the comment about md5 is incorrect. I switched to SHA512 as you can see in the code. really? :) Right s - -- return . show . md5 . L.pack $ p ++ s typical salt usage is generation of new salt for every encryption operation and storing together with encrypted data -- Best regards, Bulatmailto:[EMAIL PROTECTED] -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Interactive
Hello Andrew, Tuesday, November 25, 2008, 9:43:11 PM, you wrote: OOP seems like such a natural fit for describing the behaviour of a network of independent objects. But Haskell seems to require you to make a new, modified copy of the entire game state at each frame, which sounds... highly non-performant. most of the game state is a few mb maximum. you don't need to copy textures and other permanent game object descriptors which occupies most part of those hundredths mbs just an example from my own work: i wrote an archiver which may use, say, 500 mb for storing list of million files. but the list itslef occupies only ~10mb, so i can do all the forms of complex processing without over-loading memory manager. each file descrption is 500 bytes long, but this info isn't changed during program run -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] How to use Unicode strings?
Hello Alexey, Sunday, November 23, 2008, 10:20:47 AM, you wrote: And this problem related not only to IO. It raises whenever strings cross border between haskell world and outside world. Opening files with unicode names, execing, etc. this completely depends on libraries, and ghc-bundled i/o libs doesn't support unicode filenames. freearc project contains its own simple i/o library that doesn't have this problem (and also support files 4gb on windows). unfortunately, this library doesn't include any buffering -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] UArray Word16 Word32 uses twice as much memory as it should?
Hello Arne, Wednesday, November 19, 2008, 11:57:01 AM, you wrote: finding that it uses about twice as much memory as I had anticipated. it may be 1) GC problem (due to GC haskell programs occupies 2-3x more memory than actually used) 2) additional data (you not said how long each small array. you should expect 10-30 additional bytes used for every array) -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] implementing python-style dictionary in Haskell
Hello kenny, Tuesday, November 18, 2008, 1:37:36 PM, you wrote: The above number shows that my implementations of python style dictionary are space/time in-efficient as compared to python. thanks, interesting code 1. why you think that your code should be faster? pythob implementation is probably written in C ince it's one of its core data structures 2. you can solve IntMap problem by storing list of values with the same hash in tree's nodes -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] implementing python-style dictionary in Haskell
Hello kenny, Tuesday, November 18, 2008, 2:34:25 PM, you wrote: I am not hoping that my code should be faster, but at least not as slow as what it gets. Basically I am looking for an implementation which is close to the one in python. well, if haskell will allow to produce code not slower than C, it will be world's best language :) unfortunately, you should pay a lot for it's elegance -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] implementing python-style dictionary in Haskell
Hello Tillmann, Tuesday, November 18, 2008, 2:46:47 PM, you wrote: Why should a Haskell hash table need more memory then a Python hash table? I've heard that Data.HashTable is bad, so maybe writing a good one could be an option. about Data.HashTable: it uses one huge array to store all the entries. the catch is that GC need to scan entire array on every (major) GC. using array of hashtables may improve situation a lot plus check GC times for every version: +RTS -Soutfile -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Type question in instance of a class
Hello Maurício, Monday, November 17, 2008, 9:38:06 PM, you wrote: (...) One way to code this would be to use functional dependencies: class MyClass r s | r - s where function :: r - s One additional problem is that I (believe I) need that my class takes just one type FDs with just one type parameter are called ATs :) (FDs = functional dependencies, ATs is a new feature of ghc 6.8/6.10) -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Type question in instance of a class
Hello Maurício, Monday, November 17, 2008, 12:32:11 AM, you wrote: class MyClass r where function :: r - s this tells that f may return value of any type requested at the call site, i.e. one can write main = do print (f (Mydata 1) :: String) print (f (Mydata 1) :: [Bool]) print (f (Mydata 1) :: Either Double Float) instance MyClass (MyData v) where function (MyData a) = a this definition can return value of only one type, so it can't serve all the calls i mentioned above GHC says that the type of the result of 'function' is both determined by the rigid type from MyClass and the rigid type from MyData. But why can't both be the same? are you OOPer? :) ps: GHC error messages should be fired :) -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Type question in instance of a class
Hello J., Monday, November 17, 2008, 12:56:02 AM, you wrote: class MyClass r where function :: r - s As Bulat said, your type signature is equivalent to: function :: forall r s. r - s only function :: forall s. r - s (r is fixed in class header) -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Begginer question about alignment in Storable
Hello Maurício, Saturday, November 15, 2008, 11:29:23 PM, you wrote: struct { double w[2]; } Can I assume that its function 'alignment' should return the same as alignment (1::CDouble)? Or should it be 2 * alignment (1::CDouble)? secind - definitely not. first - probably yes -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Calling Haskell from other languages?
Hello Colin, Tuesday, November 11, 2008, 8:09:09 PM, you wrote: If I want to call Haskell (and I do, perhaps) from another garbage-collected language (Eiffel, in particular) using C as the mutually understood language, am I not going to run into big problems? of course not. there will be two independent heaps. of course you can't directly send pointers to gc-collected structures between two languages, they should be converted through buffers in C world (i.e. malloced ones) -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] mapping unfreeze over an IntMap of IOUArrays
Hello Chad, Tuesday, November 11, 2008, 10:23:09 PM, you wrote: using unsafeFreeze. I'm getting stuck here, since the IntMap library is not so monad-friendly. Data.Hashtable is -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe