Re[2]: [Haskell-cafe] Re: Windows details

2008-09-12 Thread Bulat Ziganshin
Hello Andrew, Thursday, September 11, 2008, 11:24:24 PM, you wrote: interestingly, XN seems to make GHC-compiled binary files dramatically *smaller*... huh??) probably it does `strip` on executable. -optl-s option does the same trick -- Best regards, Bulat

Re[2]: [Haskell-cafe] Re: Windows details

2008-09-12 Thread Bulat Ziganshin
Hello Andrew, Friday, September 12, 2008, 9:07:28 PM, you wrote: probably it does `strip` on executable. -optl-s option does the same trick And what exactly does a strip mean, then? stripping C debugging info, which is useless anyway -- Best regards, Bulat

Re: [Haskell-cafe] template haskell -- include a file?

2008-09-12 Thread Bulat Ziganshin
Hello Jason, Friday, September 12, 2008, 11:47:44 PM, you wrote: I'd like to use template Haskell to include as a string in a Haskell file. How do I do it? TH is a typed macrosystem - you generate special datastructure representing haskell code rather than untyped strings Is there any

Re[2]: [Haskell-cafe] packages and QuickCheck

2008-09-10 Thread Bulat Ziganshin
Hello Johannes, Wednesday, September 10, 2008, 9:39:15 AM, you wrote: Has there ever been a discussion of typed, user-definable, user-processable source code annotations for Haskell? afair it was on haskell-prime list btw, Template Haskell may be used for this purpose (although not in

Re: [Haskell-cafe] Re: Field names

2008-09-10 Thread Bulat Ziganshin
Hello Mauricio, Wednesday, September 10, 2008, 4:07:41 PM, you wrote: Do you have any reference for that use of infixing constructors by start their name with ':'? That's interesting, and I didn't know about it. really? ;) sum (x:xs) = x + sum xs sum [] = 0 -- Best regards, Bulat

Re: [Haskell-cafe] Windows console

2008-09-09 Thread Bulat Ziganshin
Hello Andrew, Tuesday, September 9, 2008, 11:15:08 PM, you wrote: Haskell. I was not, however, able to find any way at all to import the symbolic constants necessary, so I was forced to reading through the source code of the raw C header files to find out what the numeric values of these

Re: [Haskell-cafe] Haskell and Java

2008-09-09 Thread Bulat Ziganshin
Hello Mauri­cio, Tuesday, September 9, 2008, 1:36:09 PM, you wrote: I use Haskell, and my friends at work use Java. Do you think it could be a good idea to use Haskell with Java, so I could understand and cooperate with them?

Re: [Haskell-cafe] Is it usual to read a Maybe (IORef a) ?

2008-09-03 Thread Bulat Ziganshin
Hello minh, Wednesday, September 3, 2008, 2:09:38 PM, you wrote: I'd like to write a data structure to be used inside the IO monad. The structure has some handles of type Maybe (IORef a), i.e. IORef are pointers and the Maybe is like null pointers. i've not used this but overall it seems

Re[2]: [Haskell-cafe] Re: [Haskell] The initial view on typed sprintf and sscanf

2008-09-01 Thread Bulat Ziganshin
Hello Ryan, Monday, September 1, 2008, 12:16:46 PM, you wrote: of course this may be done with code generation tools (such as TH). point of this research is to do this using type abilities of Haskell Don, i think this should be impossible with IsString since the point is that Haskell compiler

Re: [Haskell-cafe] language proposal: ad-hoc overloading

2008-08-31 Thread Bulat Ziganshin
Hello Ryan, Sunday, August 31, 2008, 10:21:44 PM, you wrote: Cons: potentially exponential compile time? yes, and exponential programming complexity growth, going to brain explosion :) don't forget that OOP languages that supports ad-hoc overloading doesn't allow to infer types in both

Re: [Haskell-cafe] Syntax of 'do'

2008-08-29 Thread Bulat Ziganshin
Hello Mauri­cio, Friday, August 29, 2008, 5:41:41 PM, you wrote: afaik, this shorthand isn't exact. actually there is more code dealing with fails and this code use Monad operations Hi, http://haskell.org/haskellwiki/Keywords says that: - [do is a] syntactic sugar for use

Re[2]: [Haskell-cafe] Pure hashtable library

2008-08-28 Thread Bulat Ziganshin
Hello Richard, Thursday, August 28, 2008, 5:28:46 AM, you wrote: trie: O(len)*O(width) hashed trie: O(len) hash: O(len) If width here refers to the branching factor of the trie, it's actually O(len.lg(width)), and the width that matters is not the *possible* number of choices but the

Re[2]: [Haskell-cafe] Pure hashtable library

2008-08-28 Thread Bulat Ziganshin
Hello Don, Thursday, August 28, 2008, 10:32:43 AM, you wrote: Seems like you can make a pure hashtable by unsafePerformIO on the impure one, and exporting only 'lookup'.. probably yes, but it will lose a bit of performance due to incremental building of hashtable. actually, writing HT module

Re[2]: [Haskell-cafe] Re: [Haskell] Top Level -

2008-08-28 Thread Bulat Ziganshin
Hello Lennart, Thursday, August 28, 2008, 12:00:41 PM, you wrote: I'm certain you can write a kernel in Haskell where the only use of global variables is those that hardware interfacing forces you to use. moreover, you can write it in Turing machine. the question is just how comfortable it

Re: [Haskell-cafe] contributing to standard library

2008-08-27 Thread Bulat Ziganshin
Hello Tim, Wednesday, August 27, 2008, 1:49:51 AM, you wrote: Like everyone else who has used Haskell for a while, I'm accumulating functions which I feel should have already been in the standard libraries i have such module with 100+ functions. should i propose to add them all too? :) --

[Haskell-cafe] Pure hashtable library

2008-08-27 Thread Bulat Ziganshin
Hello haskell-cafe, solving one more task that uses English dictionary, i've thought: why we don't yet have pure hashtable library? There is imperative hashtables, pretty complex as they need to rebuild entire table as it grows. There is also simple assoc lists and tree/trie implementations,

Re[2]: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Bulat Ziganshin
Hello Jason, Wednesday, August 27, 2008, 11:55:31 AM, you wrote: given these constraints, it should be just a 10-20 lines of code, and provide much better efficiency than any tree/trie implementations Much better efficiency in what way? instead of going through many levels of tree/trie,

Re[2]: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Bulat Ziganshin
Hello Jules, Wednesday, August 27, 2008, 7:21:46 PM, you wrote: given these constraints, it should be just a 10-20 lines of code, and provide much better efficiency than any tree/trie implementations Prove it. To get much better efficient than a trie, the hash function has to be so fast

Re[2]: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Bulat Ziganshin
Hello Daniel, Wednesday, August 27, 2008, 8:01:24 PM, you wrote: trie: O(len)*O(width) hashed trie: O(len) hash: O(len) Wouldn't the hashtable have lookup time O(len+bucketsize)? i suppose that bucketsize=O(1): constructor should get [approximate] size of hashed assoclist and it will

Re[2]: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Bulat Ziganshin
Hello Stephan, Wednesday, August 27, 2008, 1:52:23 PM, you wrote: and on the other and, its implementation uses hash functions and arrays as well. IIRC it does that in a state monad that keeps the array mutable and finally freezes it before usage, which might be a good idea for pure hash

Re[2]: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Bulat Ziganshin
Hello Jan-Willem, Wednesday, August 27, 2008, 4:06:11 PM, you wrote: One obvious way to make non-modifiable hash tables useful is to eat your own tail non-strictly--- aggregate a set of hash table entries, construct a hash table from them, and plumb the resulting hash table into the

Re[2]: [Haskell-cafe] Pure hashtable library

2008-08-27 Thread Bulat Ziganshin
Hello Jules, Wednesday, August 27, 2008, 7:59:55 PM, you wrote: To get much better efficient than a trie, the hash function has to be so fast that it is faster than following (log n) pointers afaiu, trie search follows n pointers No. n is the number of strings in my data set

Re[2]: [Haskell-cafe] Re: [Haskell] Top Level -

2008-08-27 Thread Bulat Ziganshin
Hello Jonathan, Wednesday, August 27, 2008, 8:12:42 PM, you wrote: * I wonder why that name was chosen? The design doesn't seem to have anything to do with IO, it's more of a `we have this in C so we want it in Haskell too' monad. s/it/exchange with external world, i.e., essentially, I/O/

Re[4]: [Haskell-cafe] Re: [Haskell] Top Level -

2008-08-27 Thread Bulat Ziganshin
Hello Jonathan, Thursday, August 28, 2008, 12:57:19 AM, you wrote: s/it/exchange with external world, i.e., essentially, I/O/ Bald assertion. I don't buy it. What do IORefs have to do with exchange with the external world? IORefs got their names because they are implemented in IO monad :)

Re[6]: [Haskell-cafe] Re: [Haskell] Top Level -

2008-08-27 Thread Bulat Ziganshin
Hello Jonathan, Thursday, August 28, 2008, 1:11:35 AM, you wrote: IORefs got their names because they are implemented in IO monad :) But why are they implemented in the IO monad? because they need its features. but i/o may be implemented w/o IORefs. so sequence was: searching for a was to

[Haskell-cafe] Re[2]: [Haskell] Top Level -

2008-08-26 Thread Bulat Ziganshin
Hello Derek, Tuesday, August 26, 2008, 8:14:21 PM, you wrote: but from my POV it's important to push this feature into haskell standard Haskell should be moving -toward- a capability-like model, not away from it. what you mean by capability-like model? -- Best regards, Bulat

Re: [Haskell-cafe] Real World Haskell hits a milestone

2008-08-22 Thread Bulat Ziganshin
Hello Bryan, Friday, August 22, 2008, 10:10:19 PM, you wrote: I'm proud to report that John, Don and I have finished the draft manuscript of our book. It is now available online in its entirety. many thanks! the book is huge step toward in spreading Haskell to rule the world :) -- Best

Re: [Haskell-cafe] lines of code metrics

2008-08-19 Thread Bulat Ziganshin
Hello Greg, Tuesday, August 19, 2008, 8:12:00 PM, you wrote: Does anyone know of a good case study comparing a project written in C versus one written in Haskell?  I'm mostly looking for a comparison of lines of code, but any other metric, such as time to market and code quality metrics

Re[2]: [Haskell-cafe] Phantoms

2008-08-14 Thread Bulat Ziganshin
Hello Andrew, Monday, August 11, 2008, 8:32:46 PM, you wrote: Here's the thing though... How do I get it so that Foo Int and Foo Double produce slightly different strings when printed? instnace Show (Foo Int) ... instnace Show (Foo Double) ... ...WHY did I not think of this myself? o_O

Re[2]: [Haskell-cafe] Haskell equivalent toPerl stat function

2008-08-14 Thread Bulat Ziganshin
Hello John, Thursday, August 14, 2008, 8:26:00 PM, you wrote: See System.Posix.Files. ... on Unix. there is also universal function in System.Directory: getModificationTime -- :: FilePath - IO ClockTime

Re: [Haskell-cafe] Phantoms

2008-08-08 Thread Bulat Ziganshin
Hello Andrew, Wednesday, August 6, 2008, 10:09:43 PM, you wrote: Here's the thing though... How do I get it so that Foo Int and Foo Double produce slightly different strings when printed? instnace Show (Foo Int) ... instnace Show (Foo Double) ... -- Best regards, Bulat

Re[2]: [Haskell-cafe] Currying function using values from array

2008-08-07 Thread Bulat Ziganshin
Hello Sukit, Friday, August 8, 2008, 3:52:51 AM, you wrote: it requires use of typeclasses instance C f = C (a-f) curry (somef::(a-f)) (someas::[a]) = (somef (head someas)) (tail someas) and so on. look into hslua sources, for example:

Re: [Haskell-cafe] heap lifetime question

2008-08-06 Thread Bulat Ziganshin
Hello Vasili, Thursday, August 7, 2008, 9:13:43 AM, you wrote:     What is the lifetime of various heap objects ... e.g. created by allocaBytes, alloca, etc? alloca/allocaBytes just mimicks stack allocation but actually allocates buffer in usual heap. this buffer lives while references to it

Re[2]: [Haskell-cafe] heap lifetime question

2008-08-06 Thread Bulat Ziganshin
call is inside a function, when the function is exited then the said heap object is GC'd?? Regards, Vasili On Thu, Aug 7, 2008 at 12:25 AM, Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Vasili, Thursday, August 7, 2008, 9:13:43 AM, you wrote:     What is the lifetime

Re: [Haskell-cafe] timing question

2008-08-03 Thread Bulat Ziganshin
Hello Arie, Sunday, August 3, 2008, 1:56:43 PM, you wrote: *Main last . f $ xs this way you will get only spin of list computed, not elements itself. something like sum should be used instead -- Best regards, Bulatmailto:[EMAIL PROTECTED]

Re: [Haskell-cafe] an array of pointers in FFI?

2008-07-31 Thread Bulat Ziganshin
Hello Vasili, Friday, August 1, 2008, 9:08:05 AM, you wrote: Is a (Ptr (Ptr a)) a polymorphic representation of an array of pointers of type a? I want to pass an array of pointers to a C function. use Ptr (Ptr ()) Ptr () in haskell is like void* in C, it's used to represent pointer to

Re[2]: [Haskell-cafe] Cabal files on Windows

2008-07-27 Thread Bulat Ziganshin
Hello Henk-Jan, Sunday, July 27, 2008, 11:36:32 PM, you wrote: Can anyone point me to a method for including path names with spaces in a cabal file? I would like to add a line similar to the following: Have you tried replacing Program Files with PROGRA~1? This is the old i don't followed

Re: [Haskell-cafe] ANN: list-extras 0.1.0

2008-07-22 Thread Bulat Ziganshin
Hello wren, Wednesday, July 23, 2008, 6:46:01 AM, you wrote: I'm pleased to announce the initial version of list-extras, a home for common not-so-common list functions. MissingH library contained a lot of them too. i know that John Goerzen started to break it into area-specific libs, so may

Re[2]: [Haskell-cafe] ansi2html - one program, several issues

2008-07-19 Thread Bulat Ziganshin
Hello Krzysztof, Sunday, July 20, 2008, 12:49:54 AM, you wrote: on the 32-bit computers 36x memreqs for storing large strings in memory is a rule, on 64-bit ones - 72x I forgot to mention that the memory consumption is several times higher than file size. On 8,3 Mb file: 532 MB total memory

Re[2]: [Haskell-cafe] ansi2html - one program, several issues

2008-07-19 Thread Bulat Ziganshin
Hello Krzysztof, Sunday, July 20, 2008, 1:55:45 AM, you wrote: 532 MB total memory in use (4 MB lost due to fragmentation). i think that Parsec library should hold entire file in memory only when you use 'try' for whole file. otherwise it should omit data as proceeded -- Best regards, Bulat

Re: [Haskell-cafe] Fixed-Point Combinators

2008-07-16 Thread Bulat Ziganshin
Hello Adrian, Wednesday, July 16, 2008, 11:17:05 PM, you wrote: L = ?abcdefghijklmnopqstuvwxyzr. (r (t h i s i s a f i x e d p o i n t c o m b i n a t o r)) does one finde such awesome ? expressions? Is there some mathemagical background that lets one conjure such beasts? full search? :)

Re[2]: [Haskell-cafe] uvector and the stream interface

2008-07-14 Thread Bulat Ziganshin
Hello Don, Monday, July 14, 2008, 9:19:19 PM, you wrote: An abstraction stack: it would be great to document these things on wiki like we've documented old arrays -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___

Re: [Haskell-cafe] ANNOUNCE: vector 0.1 (efficient arrays with lots of fusion)

2008-07-12 Thread Bulat Ziganshin
Hello Roman, Saturday, July 12, 2008, 7:01:05 PM, you wrote: the vector library will eventually provide fast, Int-indexed arrays with a powerful fusion framework. GREAT! doom4 would be written in Haskell! -- Best regards, Bulatmailto:[EMAIL PROTECTED]

Re[2]: [Haskell-cafe] Newbie: Appending arrays?

2008-07-11 Thread Bulat Ziganshin
Hello Chaddai, Friday, July 11, 2008, 4:58:00 PM, you wrote: There are some libraries that allows you to change the size of your array, be aware though that this operation is very costly (in every language). http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ArrayRef or

Re: [Haskell-cafe] POSIX AIO (asych I/O) ...

2008-07-01 Thread Bulat Ziganshin
Hello Vasili, Tuesday, July 1, 2008, 11:42:26 AM, you wrote: looks ok, show us your peek/poke code Hello,    I am also testing my aio support. The aio_write binding seems to work ok .. as well as aio_error, Aio_return is a problem child. I think I wrote a really simple binding. I

Re: [Haskell-cafe] http://www.haskell.org/ghc/reportabug

2008-06-30 Thread Bulat Ziganshin
Hello Vasili, Sunday, June 29, 2008, 11:09:51 AM, you wrote:   When I run my test case, I get timer: internal error: scavenge: unimplemented/strange closure type 60 @ 0x76a28400 if you run low-level code that directly modifies memory via FFI functions, it's more probable that error is

Re: [Haskell-cafe] Help with generalizing function

2008-06-23 Thread Bulat Ziganshin
Hello leledumbo, Monday, June 23, 2008, 10:30:51 AM, you wrote: I've successfully create a function to return lists of N-ple that satisfy the tuples may contain any combination of types, use lists instead -- Best regards, Bulatmailto:[EMAIL PROTECTED]

Re[2]: [Haskell-cafe] Help with generalizing function

2008-06-23 Thread Bulat Ziganshin
Hello Chaddai, Monday, June 23, 2008, 1:42:25 PM, you wrote: I give up %-|, I'll go back to Pascal instead. Thanks for your answers. findAllAns 0 0 = [[]] findAllAns 0 s = [] findAllAns n s = [ x:xs | x - [0..s], xs - findAllAns (n - 1) (s - x) ] seems that leledumbo found a new way to

Re: [Haskell-cafe] What's wrong with the classes/insances?

2008-06-20 Thread Bulat Ziganshin
Hello Pieter, Saturday, June 21, 2008, 2:04:10 AM, you wrote: for me, it seems just like you directly translated OOP classes into Haskell that is the wrong way. you may look into http://haskell.org/haskellwiki/OOP_vs_type_classes and ghc user manual which discuss functional dependencies on the

Re: [Haskell-cafe] Bit streams

2008-06-18 Thread Bulat Ziganshin
Hello Andrew, Wednesday, June 18, 2008, 12:05:31 AM, you wrote: what Binary does, but with single-bit precision? [I presume Binary is http://haskell.org/haskellwiki/Library/AltBinary it's not maintained, so consider it as last hope :) -- Best regards, Bulat

Re: [Haskell-cafe] Re: Compiling large code with old machine

2008-06-18 Thread Bulat Ziganshin
Hello Dominic, Wednesday, June 18, 2008, 11:17:07 AM, you wrote: I'm using GHC to compile around 700K of Haskell Code generated by HaXml. may worth thinking about an alternative to 700k loc. i think he means bytes, not lines :) -- Best regards, Bulat

Re[2]: [Haskell-cafe] Bit streams

2008-06-18 Thread Bulat Ziganshin
Hello Malcolm, Wednesday, June 18, 2008, 4:36:40 PM, you wrote: The original Binary library, circa 1998, was based on bit-streams rather than bytes. You might be able to dig up a copy and bring it back to life. http://citeseer.ist.psu.edu/wallace98bits.html

Re: [Haskell-cafe] Compiling large code with old machine

2008-06-17 Thread Bulat Ziganshin
Hello Samuel, Tuesday, June 17, 2008, 4:19:47 PM, you wrote: My machine is Windows-XP(512MB RAM, 1.5GHz) running GHC-6.8.2. What flags make compiling fast? I try with -H500m but dont't expect. bad idea since OS needs memory too. -H400m would be much better -- Best regards, Bulat

Re[2]: [Haskell-cafe] Design your modules for qualified import

2008-06-16 Thread Bulat Ziganshin
Hello Isaac, Monday, June 16, 2008, 4:02:10 PM, you wrote: Are there multiple blah functions among the GTK modules? I.e. would GTK.blah be unambiguous, not mentioning that it's a button function. yes. actually, gtk2hs uses typeclasses to overload functions over various types -- Best

Re: [Haskell-cafe] FunPtr error?

2008-06-08 Thread Bulat Ziganshin
Hello Vasili, Monday, June 9, 2008, 6:17:14 AM, you wrote: 1. standard place to import FunPtr from is Foreign.Ptr, not System.Posix 2. FunPtr is exported as abstract type, without constructors. you can't construct values of this type directly. instead you should use wrapper generators as in the

Re[2]: [Haskell-cafe] Package updates on haskell.org

2008-06-08 Thread Bulat Ziganshin
Hello Brent, Monday, June 9, 2008, 7:43:58 AM, you wrote: The HWN, which I'm sadly too busy to maintain now, Does this imply that you're looking for someone to take over the HWN?  I'd be willing. it will be cool! -- Best regards, Bulatmailto:[EMAIL

Re[2]: [Haskell-cafe] Design your modules for qualified import

2008-06-07 Thread Bulat Ziganshin
Hello Loup, Saturday, June 7, 2008, 7:31:29 PM, you wrote: Is there any difference between: import Very.Long.Module.Name as M and: import qualified Very.Long.Module.Name as M with first you get *both* qualified and unqualified identifiers, with second - only qualified -- Best regards,

Re: [Haskell-cafe] File locking wishlist

2008-06-05 Thread Bulat Ziganshin
Hello Joachim, Thursday, June 5, 2008, 7:22:44 PM, you wrote: * Only one instance of the program runs at a time. * If new events come in while the program runs, it should re-run itself * There is information attached to the events (only one Bool ATM) So I’d like to implement something

Re: [Haskell-cafe] How would you hack it?

2008-06-04 Thread Bulat Ziganshin
Hello Andrew, Wednesday, June 4, 2008, 10:33:00 PM, you wrote: I have a file that contains several thousand words, seperated by white space. [I gather that on Unix there's a standard location for this file?] I want to end up with a file that contains a randomly-chosen selection of words.

Re[2]: [Haskell-cafe] How would you hack it?

2008-06-04 Thread Bulat Ziganshin
Hello Henning, Thursday, June 5, 2008, 12:55:19 AM, you wrote: Sounds like a generator for scientific articles. :-) Maybe http://hackage.haskell.org/cgi-bin/hackage-scripts/package/markov-chain can be of help for you. It's also free of randomIO. once i've used something like this to

Re[2]: [Haskell-cafe] How would you hack it?

2008-06-04 Thread Bulat Ziganshin
Hello Andrew, Thursday, June 5, 2008, 12:50:28 AM, you wrote: However, if you can find me a source that explains what a Markov chain actually *is*, I'd be quite interested. *afaik*, the idea is simple: order-1 Markov chain is just text generated with respect of probability of each char, and

Re: [Haskell-cafe] Re: hmatrix

2008-06-03 Thread Bulat Ziganshin
Hello Alberto, Tuesday, June 3, 2008, 11:27:54 AM, you wrote: Yes, I will try to write a simple version of Data.Array.ST... That's right, the correspondence with StorableArray is direct, and efficient conversion can be easily added to the library. I mentioned the idea of Data.Array.ST to

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

2008-06-03 Thread Bulat Ziganshin
Hello Alberto, Tuesday, June 3, 2008, 12:56:50 PM, you wrote: Good! So you can easily hide the IO operations in the ST monad. I will definitely look into it. from implementation POV ST monad is nothing but renamed IO monad which exports only subset of its operations which are guaranteed to

Re: [Haskell-cafe] Re: hmatrix

2008-06-02 Thread Bulat Ziganshin
Hello Anatoly, Yes, I will try to write a simple version of Data.Array.ST... Wouldn't it be more efficient to use StorableArray, so you can cast there is some difference between them - MutableByteArray# (used for STUArray) is movable Haskell object which is subject to GC while StorableArray

Re[2]: [Haskell-cafe] Copying Arrays

2008-05-30 Thread Bulat Ziganshin
Hello Ketil, Friday, May 30, 2008, 11:00:10 AM, you wrote: I guess this is where I don't follow: why would you need more short strings for Unicode text than for ASCII or 8-bit latin text? BS package require too much memory for storing short strings. alternative package that minimizes memory

Re[2]: [Haskell-cafe] Damnit, we need a CPAN.

2008-05-30 Thread Bulat Ziganshin
Hello Neil, Friday, May 30, 2008, 8:41:43 PM, you wrote: Our reason to not commtting Grapefruit to Hackage so far was that this would mean making an official release and we thought that Grapefruit is not yet ready for this. Release it on hackage. Releasing to hacking means other people

Re: [Haskell-cafe] Copying Arrays

2008-05-29 Thread Bulat Ziganshin
Hello Tom, Thursday, May 29, 2008, 8:21:25 PM, you wrote: Are there any low-level array types (MutableByteArray#, for example) that support a memcpy-like function yes, MBA# allows to use memcpy. you can find examples of its usage right in the array package, for example: thawSTUArray :: Ix i

Re[2]: [Haskell-cafe] Copying Arrays

2008-05-29 Thread Bulat Ziganshin
Hello Duncan, Thursday, May 29, 2008, 10:57:02 PM, you wrote: We cannot use memcpy because it operates on raw pointers but that's no good for a movable heap object like a ByteArr#. it's false assumption - memcpy is used for copying non-pinned arrays as in the code from Data.Array.Base i've

Re: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Bulat Ziganshin
Hello Henning, Wednesday, May 28, 2008, 9:51:28 AM, you wrote: We could simulate a list with strict elements, i.e. data StrictList a = Elem !a (StrictList a) | End by an unboxed array with a cursor to the next element to be evaluated and a function that generates the next element.

Re[2]: [Haskell-cafe] Lazy lists simulated by unboxed mutable arrays

2008-05-28 Thread Bulat Ziganshin
Hello Henning, Wednesday, May 28, 2008, 12:22:54 PM, you wrote: Whenever an element with an index beyond the cursor is requested, sufficiently many new elements are written to the array and the cursor is advanced. As far as I know, ByteString.Lazy is chunky, that is laziness occurs only

Re[2]: [Haskell-cafe] Trying to write a very simple HTTP Client

2008-05-23 Thread Bulat Ziganshin
Hello Johan, Friday, May 23, 2008, 5:58:04 PM, you wrote: cs- hGetLine out hClose out print cs I think you need to either print cs before you close the socket or make sure that cs is force (~computed) before you close the socket as laziness makes it get

Re[2]: [Haskell-cafe] Announce: ghc-core, command line pager for reading GHC Core

2008-05-23 Thread Bulat Ziganshin
Hello Henning, Friday, May 23, 2008, 8:31:24 PM, you wrote: would guarantee speed in every case. Or I can SPECIALISE the function, then the function will only be called, but with polymorphism overhead eliminated. This would only work for a restricted range of types. I'd like to have a

Re: [Haskell-cafe] Rotating backdrop (aka learning Haskell)

2008-05-20 Thread Bulat Ziganshin
Hello Yann, Tuesday, May 20, 2008, 12:15:57 PM, you wrote: To help me learn Haskell, I decided on a simple (AH!) problem: given a list of images, display a random one as my desktop backdrop. After some time, change the image. Simple? what you try to implements looks like too large

Re: [Haskell-cafe] Re: MD5 performance optimizations, and GHC -via-C producing segfaulting binary

2008-05-20 Thread Bulat Ziganshin
Hello Andrew, Tuesday, May 20, 2008, 11:05:52 PM, you wrote: -funbox-strict-fields. I did try that, but it didn't seem to make any difference for me. [Maybe it may be that ghc just not recompiled program when you supplied this switch. as i wrote, this switch by itself made your original

Re[2]: [Haskell-cafe] Re: MD5 performance optimizations, and GHC -via-C producing segfaulting binary

2008-05-20 Thread Bulat Ziganshin
Hello Don, Wednesday, May 21, 2008, 12:13:14 AM, you wrote: it is not enabled by default, because for *non-primitive* datatypes I'm confused. GHC of course unboxes strict fields of primitive data types. {-# OPTIONS -O2 -fvia-C -optc-O2 -funbox-strict-fields #-} it is not enabled by

Re[2]: [Haskell-cafe] Re: MD5 performance optimizations

2008-05-20 Thread Bulat Ziganshin
Hello Andrew, Wednesday, May 21, 2008, 12:09:39 AM, you wrote: Right, OK - so strict evaluation, but some bitpattern in RAM. yes. in particular this allows to designate fields that should de initialized: data A = A {a :: Int, b :: !Int} main = print A{} it is not enabled by default, because

Re[2]: [Haskell-cafe] Performance: MD5

2008-05-18 Thread Bulat Ziganshin
Hello Neil, Sunday, May 18, 2008, 12:54:30 PM, you wrote: One day, I hope that high-level Haskell will outperform C all the time. It's already true with some of the ByteString stuff, but i don't think so. all the tests where Haskell outperform C i've seen was just unfair - for example they

Re[2]: [Haskell-cafe] Performance: MD5

2008-05-18 Thread Bulat Ziganshin
Hello Andrew, Sunday, May 18, 2008, 3:42:23 PM, you wrote: How much do you want to bet that the C version just reads a chunk of data into RAM and then does a simple type-cast? (If I'm not very much mistaken, in C a type-cast is an O(0) operation.) try unsafeCoerce# for that. or just use

Re[2]: [Haskell-cafe] Performance: MD5

2008-05-18 Thread Bulat Ziganshin
Hello Andrew, Sunday, May 18, 2008, 3:42:23 PM, you wrote: Isn't there some function kicking around somewhere for acessing arrays without the bounds check? Similarly, I'm sure I remember the Data.Bits bounds check being mentioned before, and somebody saying they had [or were going to?] make

Re: [Haskell-cafe] Multi threaded garbage collector

2008-05-18 Thread Bulat Ziganshin
Hello Peter, Sunday, May 18, 2008, 4:47:22 PM, you wrote: If I understood it correctly, the current garbage collector of GHC is single threaded, which really hinders SMP Any plans on improving this or workarounds? workaround - decrease GC times. read GHC manual for switches that

Re[2]: [Haskell-cafe] Performance: MD5

2008-05-18 Thread Bulat Ziganshin
Hello Brandon, Sunday, May 18, 2008, 5:48:48 PM, you wrote: Bulat Ziganshin wrote: if you need maximum efficiency, drop all this high-level code and map md5.c to haskell as it was done in Don's blog Bulat is the naysayer of the group; according to him Haskell is a nice idea

Re[2]: [Haskell-cafe] Performance: MD5

2008-05-18 Thread Bulat Ziganshin
Hello Brandon, Sunday, May 18, 2008, 6:25:31 PM, you wrote: There's a difference. When I started (GHC 6.4.2 was current), Bulat was spending his mailing list time denying the possibility of what DPH does now, and claiming that what GHC 6.8.2 does now was unlikely. what DPH and 6.8.2 does? i

Re[2]: [Haskell-cafe] Performance: MD5

2008-05-18 Thread Bulat Ziganshin
Hello Brandon, Sunday, May 18, 2008, 6:25:31 PM, you wrote: Optimization is hard. Don't like it? Become a compiler researcher and find better ways to do it. Note that C / procedural language optimization research has at least a 20-year head start on functional programming optimization,

Re[4]: [Haskell-cafe] Performance: MD5

2008-05-18 Thread Bulat Ziganshin
Hello Brandon, Sunday, May 18, 2008, 6:58:34 PM, you wrote: and a few lines later you repeat what i said few years ago - ghc optimization research has got 100x times less attention than C++ optimization so we can't expect the same results in the next 5-10 Mmm, no. You tend to say, or at

Re[2]: [Haskell-cafe] Re: Another optimization question

2008-05-18 Thread Bulat Ziganshin
Hello Luke, Sunday, May 18, 2008, 7:11:13 PM, you wrote: primes :: Integral a = [a] you might be computing the list of primes many times. Using a monomorphic signature like [Int] or [Integer] will allow primes to be cached, probably increasing the performance quite dramatically. besides

Re[6]: [Haskell-cafe] Performance: MD5

2008-05-18 Thread Bulat Ziganshin
Hello Brandon, Sunday, May 18, 2008, 7:15:17 PM, you wrote: we don't have ghc optimized as good as gcc. when i tell about it, you tell that i'm not right. then you tell that ghc may be improved in You're doing a remarkably good job of not hearing what I say. Hard may be. so, when i

Re[8]: [Haskell-cafe] Performance: MD5

2008-05-18 Thread Bulat Ziganshin
Hello Brandon, Sunday, May 18, 2008, 7:24:12 PM, you wrote: You're doing a remarkably good job of not hearing what I say. Hard Elide the part that says that it's not worth it and repeat yourself yet again? Bah. Brandon, you've contradicted to my USEFUL suggestion with a tons of USELESS

Re[2]: [Haskell-cafe] Performance: MD5

2008-05-18 Thread Bulat Ziganshin
Hello Ketil, Sunday, May 18, 2008, 7:44:38 PM, you wrote: Anyway - with more and more aggressive caching, and ever increasing number of cores, it looks like C is an even poorer fit for the hardware than it used to be doubling number of cores every 1.5 years, we should see 1000-core monsters

Re[2]: [Haskell-cafe] Type inference; always

2008-05-18 Thread Bulat Ziganshin
Hello Derek, Sunday, May 18, 2008, 9:10:38 PM, you wrote: This is incorrect. There are two (other) situations where you need type annotations in Haskell 98. One situation is when you use polymorphic recursion, but that is pretty rare unless you are writing nested data types can you give

Re: [Haskell-cafe] My experience setting up Haskell up for GUI development

2008-05-18 Thread Bulat Ziganshin
Hello Ben, Sunday, May 18, 2008, 10:26:09 PM, you wrote: I'm running Windows Vista and I've been trying to set up an environment for writing GUI applications. i'm a XP user, nevertheless try this for gtk2hs: 6.6.1: http://haskell.org/ghc/dist/6.6.1/ghc-6.6.1-i386-windows.exe

Re: [Haskell-cafe] My experience setting up Haskell up for GUI development

2008-05-18 Thread Bulat Ziganshin
Hello Ben, Sunday, May 18, 2008, 10:26:09 PM, you wrote: So, in practice, do other people write GUI apps with Haskell on Windows? And if they do, how do they do it? I feel I've got to the stage where I need a concrete recommendation from the experts. after i've wrote a few thousands lines

Re[4]: [Haskell-cafe] Fun with Darcs

2008-05-18 Thread Bulat Ziganshin
Hello Duncan, Friday, May 16, 2008, 2:05:53 AM, you wrote: Of course if you're deploying a Windows program that uses gtk2hs then using just the runtime dlls is just the right thing to do. Though for that case we provide the runtime dlls: http://haskell.org/gtk2hs/win32/ As an example,

Re[2]: [Haskell-cafe] My experience setting up Haskell up for GUI development

2008-05-18 Thread Bulat Ziganshin
Hello Duncan, Monday, May 19, 2008, 1:18:10 AM, you wrote: As far as I know the visual differences are pretty small. If you know of anything specific we can file bugs with the Gtk+ folk, they've fixed lots of little differences over the last few years. file open dialogs; treeview -- Best

Re: [Haskell-cafe] Performance: MD5

2008-05-17 Thread Bulat Ziganshin
Hello Andrew, Saturday, May 17, 2008, 6:51:27 PM, you wrote: If anybody has any interesting insights as to why my version is so damned slow, I'd like to hear them. i equally will be interesting to hear why you think what your program should be as fast as C version? you wrote it in purely

Re: [Haskell-cafe] How to use arrays efficiently?

2008-05-16 Thread Bulat Ziganshin
Hello Lauri, Friday, May 16, 2008, 12:19:29 PM, you wrote:     pixelArray :: Array Int Color it's boxed array which means that its elements are stored as thunks computed only when you actually use them. try UArray instead: http://haskell.org/haskellwiki/Modern_array_libraries -- Best

Re: [Haskell-cafe] Std lib equivalent for liftM concat . sequence

2008-05-16 Thread Bulat Ziganshin
Hello Alistair, Friday, May 16, 2008, 2:12:45 PM, you wrote: concatM = liftM concat . sequence but found no such thing in the std libs, except perhaps for msum (I don't want to add instances for MonadPlus. Should I have to?). Have I missed something trivial? 1. it's easy to define yourself

Re[2]: [Haskell-cafe] How to use arrays efficiently?

2008-05-16 Thread Bulat Ziganshin
for me. Regards, Lauri On Fri, May 16, 2008 at 11:37 AM, Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Lauri, Friday, May 16, 2008, 12:19:29 PM, you wrote: pixelArray :: Array Int Color it's boxed array which means that its elements are stored as thunks computed only

Re[2]: [Haskell-cafe] How to use arrays efficiently?

2008-05-16 Thread Bulat Ziganshin
Hello Ketil, Friday, May 16, 2008, 5:27:29 PM, you wrote: I guess it would be possible to have UArray Int (# Double, Double, Double #) - packing all three Doubles unboxed into the array, but I've no clue how to go about automating that. unoxed tuple doesn't have a box so it cannot be

Re[2]: [Haskell-cafe] How to use arrays efficiently?

2008-05-16 Thread Bulat Ziganshin
Hello Lauri, Friday, May 16, 2008, 5:45:50 PM, you wrote: Yes, of course. How blind of me. Here is one more question. If you change IOUArray to IOArray and add $! in front of the two summations in the previous code, it still works correctly. But can you do similar trick with Array and

Re: [Haskell-cafe] Re: Write Haskell as fast as C. [Was: Re: GHC predictability]

2008-05-16 Thread Bulat Ziganshin
Hello Andrew, Friday, May 16, 2008, 10:56:36 PM, you wrote: On the other hand, this is the anti-theisis of Haskell. We start with a high-level, declarative program, which performs horribly, and end up with a manually hand-optimised blob that's much harder to read but goes way faster.

<    3   4   5   6   7   8   9   10   11   12   >