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, bu

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/

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 >

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 t

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 o

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

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 m

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

2008-08-27 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

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

2008-08-27 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 w

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: [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 direct

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 sh

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 l

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 thes

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? http://haskell.org/haskellwiki/Applications_and_libraries/In

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

2008-09-09 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 porta

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[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, Bulatmail

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 a

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

2008-09-13 Thread Bulat Ziganshin
Hello Andrew, Saturday, September 13, 2008, 5:13:21 PM, you wrote: > Well, you must either be running under a different OS or have Cygwin > installed, because when I try it, it just complains constantly. ("Can't > find gcc", "can't find cc1", "can't find crt.o", and so forth.) At this > point, I'

Re: [Haskell-cafe] a question about concurrent haskell

2008-09-18 Thread Bulat Ziganshin
Hello Manlio, Thursday, September 18, 2008, 11:01:10 PM, you wrote: you just need to handle it in a message-passing way. this type of problem (serializing access to unique resource) is rather common, for example it's used in GUI libs. std way is to create thread that will do actual work in sequen

Re[2]: [Haskell-cafe] performance of map reduce

2008-09-19 Thread Bulat Ziganshin
Hello Don, Friday, September 19, 2008, 9:12:43 PM, you wrote: >> It is possible to implement a map reduce version that can handle gzipped >> log files? > Using the zlib binding on hackage.haskell.org, you can stream multiple > zlib decompression threads with lazy bytestrings, and combine the > r

Re: [Haskell-cafe] OpenSPARC project applicant chosen

2008-09-21 Thread Bulat Ziganshin
Hello Duncan, Saturday, September 20, 2008, 7:37:08 PM, you wrote: > http://haskell.org/opensparc/ the page says that you still search for a student how community server may be used to measure performance? i'm interested in doing some benchmarks but afaiu this needs exclusive access for some ti

Re[2]: [Haskell-cafe] Drawing an existing image into a cairo surface?

2008-09-21 Thread Bulat Ziganshin
Hello Rafal, Sunday, September 21, 2008, 5:43:14 PM, you wrote: > withImageSurfaceFromPNG file $ \png -> do > w <- renderWith png $ imageSurfaceGetWidth png > h <- renderWith png $ imageSurfaceGetHeight png this is very idiomatic Haskell, consider it as a sort of RAII. you

Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Manlio, Monday, September 22, 2008, 1:46:55 PM, you wrote: > This is cheating, IMHO. > Some test comparisons are unfair. this overall test is uselles for speed comparison. afair, there are only 2-3 programs whose speed isn't heavily depend on libraries. in DNA test, for example, Tcl (or PH

Re: [Haskell-cafe] Re: ANNOUNCE: protocol-buffers-0.2.9 for Haskell is ready

2008-09-22 Thread Bulat Ziganshin
Hello Chris, Monday, September 22, 2008, 2:48:16 PM, you wrote: > used a very unreliable trick. And the "use castToSTUArray" suggested > alternative is a really poor one since I am not using arrays at all. castToSTUArray does the same as your code, only in ST monad so you can skip unsafePerform

Re[4]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Simon, Monday, September 22, 2008, 9:03:52 PM, you wrote: > With bytestrings, unboxed arrays, light-weight threads and other > tricks, we can usually replace all those ugly low-level programs with > nice high-level haskell ones i don't think that these 3 libs allows to write high-level hig

Re[6]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Graham, >> i don't think that these 3 libs allows to write high-level >> high-performance code in *most* cases. just for example, try to write wc >> without using "words". > To a newbie, that's a cryptic statement. Are you saying that these > libs aren't needed to make a high-performance "w

Re[2]: [Haskell-cafe] Line noise

2008-09-22 Thread Bulat Ziganshin
Hello Luke, Monday, September 22, 2008, 11:00:12 PM, you wrote: >> mapM_ (\(n,v) -> putStrLn $ "[" ++ show n ++ "] = " ++ show v) (zip [0..] >> vs) > forM_ (zip [0..] vs) $ \(n,v) -> putStrLn $ "[" ++ show n ++ "] = " ++ > show v for (zip [0..] vs) $ \(n,v) -> do putStrLn $ "[" ++ show

Re[8]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Isaac, Monday, September 22, 2008, 11:49:30 PM, you wrote: >> i mean that naive haskell code is very slow and 3 or 5 or twelve libs >> can't solve the problem of ghc generating slow code > Is there something particularly fascinating about naive code written in > any language? yes, in asm

Re[10]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Jonathan, Tuesday, September 23, 2008, 12:30:19 AM, you wrote: >> yes, in asm number of instructions executed more or less define >> number of CPU cycles used. well, i more or less know all this stuff. but are you really compare to Haskell??? does Haskell programs typically written i

Re[8]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Donnie, Tuesday, September 23, 2008, 2:53:17 AM, you wrote: > i mean that naive haskell code is very slow and 3 or 5 or twelve libs > can't solve the problem of ghc generating slow code > I'm fairly new to Haskell and the Haskell community, but I can say > from my experience of hacking on

Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Gwern, Tuesday, September 23, 2008, 3:33:02 AM, you wrote: >> high-performance code in *most* cases. just for example, try to write wc >> without using "words" > seems to do fine; you'll notice > it drops "lines" after the first version. actually it cou

Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Don, Tuesday, September 23, 2008, 3:12:37 AM, you wrote: >> for the same reason i don't feed 5000 men with 7 breads - it's not my >> business ;) > Ok. So I'll just say: high level, efficient code is an overriding theme > of many individuals working on Haskell. Things are better and better

Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Don, Tuesday, September 23, 2008, 4:22:19 AM, you wrote: > bulat.ziganshin: >> when gcc developers will start to add to C libraries functions >> performing shootout benchmarks we will continue this discussion :D > atoi(3). it isn't the same as readInt which was added specifically for this

Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Don, Tuesday, September 23, 2008, 4:36:55 AM, you wrote: >> it isn't the same as readInt which was added specifically for this >> test. it doesn't support arbitrary-size streams and doesn't return >> rest of stream >> > Hmm? That is wrong. These functions explicitly work on arbitrarily lo

Re[4]: [Haskell-cafe] Climbing up the shootout...

2008-09-22 Thread Bulat Ziganshin
Hello Chaddaï, Tuesday, September 23, 2008, 4:39:18 AM, you wrote: >> it isn't the same as readInt which was added specifically for this >> test. it doesn't support arbitrary-size streams and doesn't return >> rest of stream > I think we should write all the entries in Haskell98 and disable any

Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-23 Thread Bulat Ziganshin
Hello Manlio, Tuesday, September 23, 2008, 1:36:16 PM, you wrote: > Any roadmap for improve support in intensive IO multiplexing? > Or, at least, some papers about how this is implemented in GHC? > Af far as I understand, select is used in two separate places. > How much effort it takes to imple

Re[4]: [Haskell-cafe] Climbing up the shootout...

2008-09-23 Thread Bulat Ziganshin
Hello Sterling, Tuesday, September 23, 2008, 5:13:57 AM, you wrote: > Oh, and it "simply and naively" loops with the following: > while (fgets_unlocked (line, MAXLINELEN, stdin)) > If Bulat's point is that the shootout has inspired work on Haskell > performance, and in the stdlibs no less, then

Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-23 Thread Bulat Ziganshin
Hello Jules, Tuesday, September 23, 2008, 2:21:34 PM, you wrote: >> performance. what we have on prcatice is 10-20% speedup of ghc 6.8 and >> several libs which may improve speed in some usages > If you understand performance as well as you claim to - and from your > previous postings, I believ

Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-23 Thread Bulat Ziganshin
Hello Manlio, Tuesday, September 23, 2008, 3:14:58 PM, you wrote: > Maybe improve GHC to make Haskell suitable to write high reliable > internet servers is not of interest? well if it's interesting - do it :) various people do that they find most exciting/important. actually, alt-network packag

Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-23 Thread Bulat Ziganshin
Hello Manlio, Tuesday, September 23, 2008, 3:43:03 PM, you wrote: >>> Maybe improve GHC to make Haskell suitable to write high reliable >>> internet servers is not of interest? >> >> well if it's interesting - do it :) > Unfortunately, I no more have the time for "do it your self", unless >

Re[6]: [Haskell-cafe] Climbing up the shootout...

2008-09-23 Thread Bulat Ziganshin
Hello John, Tuesday, September 23, 2008, 4:27:05 PM, you wrote: >> amount of work required to do this is much much more than amount of work >> required to write optimal C/asm code > I'm sorry, but no it's not. I've been using Haskell for a little > under two years now, and I'm already able to p

Re[8]: [Haskell-cafe] Climbing up the shootout...

2008-09-23 Thread Bulat Ziganshin
Hello John, Tuesday, September 23, 2008, 5:39:17 PM, you wrote: > Probably not, but I think you completely missed my point. Perhaps I > should have originally written "my original C equivalents" rather > than "the". You're probably just a better C programmer than me. well, i don't say about me p

Re[10]: [Haskell-cafe] Climbing up the shootout...

2008-09-23 Thread Bulat Ziganshin
Hello Donnie, Tuesday, September 23, 2008, 7:16:04 PM, you wrote: > I don't understand why you are willing to criticize GHC, but > unwilling to help improve GHC.  Personally, I think it is a waste of > everyone's time for you to just complain about GHC without offering > suggestions on how to imp

Re: [Haskell-cafe] Injecting Haskell into C

2008-09-24 Thread Bulat Ziganshin
Hello Roman, Wednesday, September 24, 2008, 2:04:38 PM, you wrote: > As I understand, there are two ways to do that. Either Haskell code is > called from C, or C code is called for Haskell. So my questions are: > 1. Are they both possible? yes. "foreign export" exports Haskell functions to C wor

Re[8]: [Haskell-cafe] Climbing up the shootout...

2008-09-24 Thread Bulat Ziganshin
Hello Brandon, Wednesday, September 24, 2008, 9:36:56 PM, you wrote: > Because he's convinced himself it's pointless because Haskell will > never be able to run faster than C taking into account that C compilers are very close to maximum speed possible, and this required many years of developemn

Re[10]: [Haskell-cafe] Climbing up the shootout...

2008-09-24 Thread Bulat Ziganshin
Hello Brandon, Wednesday, September 24, 2008, 11:13:14 PM, you wrote: > can come up with, including amorphous and vacuous ones" (you can > almost always write something faster, but with how much effort?) as i said, eddorts to optimize Haskell code is several times larger while the result is seve

Re[12]: [Haskell-cafe] Climbing up the shootout...

2008-09-24 Thread Bulat Ziganshin
Hello Brandon, Thursday, September 25, 2008, 12:43:55 AM, you wrote: >> as i said, eddorts to optimize Haskell code is several times larger >> while the result is several times slower > ...and we're back to "dons demonstrated otherwise, so you have to please show me example that you mean and

Re[12]: [Haskell-cafe] Climbing up the shootout...

2008-09-24 Thread Bulat Ziganshin
Hello Brandon, Thursday, September 25, 2008, 12:43:55 AM, you wrote: >> as i said, eddorts to optimize Haskell code is several times larger >> while the result is several times slower > ...and we're back to "dons demonstrated otherwise, so you have to > invent reasons to disqualify him". If a

Re[14]: [Haskell-cafe] Climbing up the shootout...

2008-09-24 Thread Bulat Ziganshin
Hello david48, Thursday, September 25, 2008, 1:38:55 AM, you wrote: >> please show me example that you mean and i will show exact reasons >> why this Haskell code wasn't compared to the best C code > The shootout seems pretty popular, and there's still a lot of C > programmers around, so I wonder

Re[16]: [Haskell-cafe] Climbing up the shootout...

2008-09-24 Thread Bulat Ziganshin
ojects, why couldn't the C programs just implement > very specific version of the third party library inside their code? Is there > anything stopping them? > > On Wed, Sep 24, 2008 at 5:50 PM, Bulat Ziganshin > <[EMAIL PROTECTED]> wrote: > Hello david48, >

Re[2]: [Haskell-cafe] pure Haskell database

2008-09-25 Thread Bulat Ziganshin
Hello jean-christophe, Thursday, September 25, 2008, 1:52:26 PM, you wrote: > columns = [ ("trackId", conT ''Int ) > It looks like a not ended string literal unless I still have sth to learn > about Haskell. it's TemplateHaskell, look for Reification in http://www.haskell.org/bz/thdoc.htm

Re[2]: [Haskell-cafe] Climbing up the shootout...

2008-09-25 Thread Bulat Ziganshin
Hello Ketil, Thursday, September 25, 2008, 8:57:05 PM, you wrote: > "John Van Enk" <[EMAIL PROTECTED]> writes: >> I'm going to have to agree with David... even if you ignore the >> multi-threaded >> projects, why couldn't the C programs just implement very specific version of >> the third party

Re[2]: [Haskell-cafe] The container problem

2008-09-26 Thread Bulat Ziganshin
Hello Andrew, Saturday, September 27, 2008, 1:37:12 AM, you wrote: answering your questions 1) there is 2 libs providing common Java-like interfaces to containers: Edison and Collections. almost noone uses it 2) having common type class for various things is most important when you write librar

Re[2]: [Haskell-cafe] Hmm, what license to use?

2008-09-27 Thread Bulat Ziganshin
Hello Magnus, Saturday, September 27, 2008, 3:48:27 PM, you wrote: > AFAIU you are saying that the linker is reaching into the module's .a > file, pulling out the .o file, and then reaching into that .o file to > pull out an individual function's ASM code. I believe that's a bit more > than regu

Re[2]: [Haskell-cafe] The container problem

2008-09-27 Thread Bulat Ziganshin
Hello Andrew, Saturday, September 27, 2008, 9:23:47 PM, you wrote: > Can anybody actually demonstrate concretely how FDs and/or ATs would > solve this problem? (I.e., enable you to write a class that any > container can be a member of, despite constraints on the element types.) you may find com

Re: [Haskell-cafe] about logical computation

2008-09-29 Thread Bulat Ziganshin
Hello z_axis, Monday, September 29, 2008, 11:22:22 AM, you wrote: > hi, friends > I am a Haskell newbie however i like it very much. After starting > learn haskell, i donot find the corresponding "&", "|" , "~", "<<", > ">>" logical computation of C language. import Data.Bits just its exports:

Re[2]: [Haskell-cafe] Re: Hmm, what license to use?

2008-10-02 Thread Bulat Ziganshin
Hello Don, Thursday, October 2, 2008, 12:07:47 PM, you wrote: >> Don, I usually agree with almost everything you say -- but not this! and i usually answer only in those few cases when i disagree ;) > My point was really that investing the effort required to get nhc98 into > the shape that we co

Re: [Haskell-cafe] A question about constraints

2008-10-02 Thread Bulat Ziganshin
Hello jean-christophe, Thursday, October 2, 2008, 1:46:20 PM, you wrote: > If one wants to use pattern matching, afaik we had so-called views in early haskell versions. they proivide way to define two-way constructors - used for deconstruction via pattern-matching too views wa removed from hask

Re[2]: [Haskell-cafe] One liner?

2008-10-02 Thread Bulat Ziganshin
Hello Neil, Thursday, October 2, 2008, 7:26:23 PM, you wrote: shortly speaking, getDirectoryContents is an action (having "IO a" type) while second mapM_ argument should be a value returned by this action. by using dc variable or >>= operator, you can evaluate action and pass its result to mapM_.

Re[2]: [Haskell-cafe] Hmm, what license to use?

2008-10-02 Thread Bulat Ziganshin
Hello Wolfgang, Thursday, October 2, 2008, 11:25:52 PM, you wrote: >> > You mean shared libraries without the opportunity to inline library code? >> > This would result in a huge performance loss, I think. >> >> Usually _mild_ performance loss, in exchange for major code-size >> savings, I would

Re[2]: [Haskell-cafe] Hmm, what license to use?

2008-10-02 Thread Bulat Ziganshin
Hello Don, Friday, October 3, 2008, 2:22:49 AM, you wrote: >> and type classes. once i've forget to addinline pragma, my program >> (serializing arrays) becomes 200x slower. it was due to use of >> hieararchy of several type classes. afaiu, their dictionaries are also >> lazily evaluated plus we

Re: [Haskell-cafe] Name for Haskell based VPN Client/Server

2008-10-06 Thread Bulat Ziganshin
Hello John, Monday, October 6, 2008, 10:29:09 PM, you wrote: > I'm working on a Haskell based VPN. I can't think of any good names, so I'm > crowd sourcing it. octopus? (it was a good serial about italian mafia spreading its palpi all over the country :) -- Best regards, Bulat

Re[2]: [Haskell-cafe] newbie questions (read, etc., with Data.ByteString.Lazy.Char8)

2008-10-07 Thread Bulat Ziganshin
Hello wman, Tuesday, October 7, 2008, 8:44:48 AM, you wrote: > btw, why is the example #2 > (http://shootout.alioth.debian.org/gp4/benchmark.php?test=sumcol&lang=ghc&id=2) > (which kicks collective asses of all other participants) not > considered in the shootout ? Too much optimizations ? it's

Re[2]: [Haskell-cafe] newbie questions (read, etc., with Data.ByteString.Lazy.Char8)

2008-10-07 Thread Bulat Ziganshin
Hello Brandon, Tuesday, October 7, 2008, 7:59:06 AM, you wrote: > is there a reason why -O2 shouldn't be made the default (and > allowing to turn off optimizations by -O0 perhaps) ? it compiles ~2x slower and firces more recompilation (because it does inter-module inlining). so it's not perfect

Re: [Haskell-cafe] Type classes question

2008-10-07 Thread Bulat Ziganshin
Hello Roly, Tuesday, October 7, 2008, 4:13:25 PM, you wrote: > I'm reasonably well versed in Haskell but fairly new to defining type classes. http://haskell.org/haskellwiki/OOP_vs_type_classes may be useful -- Best regards, Bulatmailto:[EMAIL PROTECTED] __

Re[2]: [Haskell-cafe] Query regarding Type classes

2008-10-13 Thread Bulat Ziganshin
Hello Arun, Monday, October 13, 2008, 2:50:27 PM, you wrote: > I agree that this does look more succinct... but what if I write some generic > code for the > in the render method of the Drawable class and package it into a library.. i recommend you to read http://haskell.org/haskellwiki/OOP_vs_

Re[2]: [Haskell-cafe] Could not build win32 dll..

2008-10-13 Thread Bulat Ziganshin
Hello Ian, Monday, October 13, 2008, 9:47:12 PM, you wrote: > http://www.haskell.org/ghc/docs/6.8.3/html/users_guide/win32-dlls.html this page says "Since this Haskell DLL depends on a couple of the DLLs that come with GHC, make sure that they are in scope/visible." i just checked 6.8.3 install

Re: [Haskell-cafe] Very silly

2008-10-13 Thread Bulat Ziganshin
Hello Andrew, Monday, October 13, 2008, 10:51:43 PM, you wrote: > Suffice it to say, you *can* make Haskell support arbitrary overloading > of function names like C++ has, _if_ you abuse the type system violently > enough. Please, won't somebody think of the children?!? people that make critique

Re[2]: [Haskell-cafe] Very silly

2008-10-13 Thread Bulat Ziganshin
Hello Andrew, Tuesday, October 14, 2008, 12:15:04 AM, you wrote: >> people that make critique on haskell type classes, don't take into >> account that it's unlike C++ templates, implemented via run-time >> dictionaries and other modules may define new instances >> > Personally, I have no clue

Re[2]: [Haskell-cafe] Flexible instances

2008-10-15 Thread Bulat Ziganshin
Hello Albert, Wednesday, October 15, 2008, 7:51:06 AM, you wrote: >>> Illegal instance declaration for `Stringable [Char]' >>> (All instance types must be of the form (T a1 ... an) >>> where a1 ... an are distinct type *variables* > Just in case: n=0 for "instance Eq Blah", i.e.

Re: [Haskell-cafe] Haskell newbie indentation query.

2008-10-15 Thread Bulat Ziganshin
Hello Vivek, Wednesday, October 15, 2008, 3:39:54 PM, you wrote: i think that practical answer is suggestion to use `case` instead: case () of _ | x < 5 -> do abc def ... | x==5 -> do ... | otherwise -> do ... it's pretty common pa

Re: [Haskell-cafe] Type safety in foreign pointer

2008-10-15 Thread Bulat Ziganshin
Hello Mauricio, Wednesday, October 15, 2008, 5:40:16 PM, you wrote: > newtype SomeStruct = SomeStruct () data SomeStruct = SomeStruct looks even simpler. you don't need to shell around () since you anyway will not use its value :) -- Best regards, Bulatmailto:[EM

Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Bulat Ziganshin
Hello David, Wednesday, October 15, 2008, 7:16:09 PM, you wrote: > I've read a lot of the Monad tutorials, and I feel like I only get > "most of it" to be 100% honest.  The State Monad still boggles my > mind a little bit.  I understand what it's supposed to do and I get > the idea about how it w

Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Bulat Ziganshin
Hello Daryoush, Wednesday, October 15, 2008, 10:56:39 PM, you wrote: > If you notice  java generics has all sort of gotchas (e.g. > http://www.ibm.com/developerworks/java/library/j-jtp01255.html).  I large prob;em of OOP languages with generics is interaction between those two types of polymorhi

Re: [Haskell-cafe] Writing a function isPrime using recursion.

2008-10-15 Thread Bulat Ziganshin
Hello Kalashnikov, Thursday, October 16, 2008, 2:41:05 AM, you wrote: > I'm supposed to write a function isPrime that checks whether or not a given > integer is a prime number or not. The function has to use recursion. The > only advice I was given, was to use a helper function. seems that russi

Re[2]: [Haskell-cafe] is 256M RAM insufficient for a 20 million element Int/Int map?

2008-10-18 Thread Bulat Ziganshin
Hello Derek, Sunday, October 19, 2008, 12:40:43 AM, you wrote: > In GHC, a linked list is about 12 bytes per cons (on a 32-bit computer). this isn't a whole picture. due to Garbage Collection, actual memory use is 2-3 times higher (although you can make this coef. as close to 1 as you want by co

Re[2]: [Haskell-cafe] is 256M RAM insufficient for a 20 million element Int/Int map?

2008-10-19 Thread Bulat Ziganshin
Hello Bertram, Sunday, October 19, 2008, 6:19:31 AM, you wrote: > That's 5 words per elements ... that, like everything else, should be multiplied by 2-3 to account GC effect -- Best regards, Bulatmailto:[EMAIL PROTECTED] __

Re[3]: [Haskell-cafe] is 256M RAM insufficient for a 20 million element Int/Int map?

2008-10-19 Thread Bulat Ziganshin
Hello Philippa, Sunday, October 19, 2008, 3:25:26 PM, you wrote: >> ... that, like everything else, should be multiplied by 2-3 to >> account GC effect > Unless I'm much mistaken, that isn't the case when you're looking at the > minimum heap size because the GC'll run more frequently when you hi

Re[4]: [Haskell-cafe] is 256M RAM insufficient for a 20 million element Int/Int map?

2008-10-19 Thread Bulat Ziganshin
Hello Philippa, Sunday, October 19, 2008, 3:58:35 PM, you wrote: >> what you mean? max heap size is 2gb probably. it may be configured on > Ah, so you can't trust GHC to pick a max heap size within what the OS > actually has available? hm, this includes virtual memory too. there are code snipp

Re: [Haskell-cafe] A heretic question

2008-10-19 Thread Bulat Ziganshin
Hello Achim, Monday, October 20, 2008, 1:08:06 AM, you wrote: > thinking Haskell or Scheme, and if I'm thinking performance, C itself > more than suffices. ... and machine code too :D C++ is the highest level language that provide asm-like speed, so it's hard to find reasons to use C instead. a

Re[2]: [Haskell-cafe] A heretic question

2008-10-19 Thread Bulat Ziganshin
Hello ajb, Monday, October 20, 2008, 4:50:45 AM, you wrote: > The trouble is that C++ is a tool that's hard to use well. But that's > why they pay us the big bucks, right? i think that one day we will hear that ML was too easy language and they invented Haskell in order to keep future salaries

Re: [Haskell-cafe] Re: A heretic question

2008-10-21 Thread Bulat Ziganshin
Hello Benjamin, Tuesday, October 21, 2008, 8:13:55 AM, you wrote: > Maybe this is just me, but if I had to choose a tool, I'd choose one > that would be easy to use well. and what tool you choose in 80's? :) -- Best regards, Bulatmailto:[EMAIL PROTECTED]

Re[2]: [Haskell-cafe] Re: A heretic question

2008-10-21 Thread Bulat Ziganshin
Hello Colin, Tuesday, October 21, 2008, 12:56:30 PM, you wrote: > Bulat> and what tool you choose in 80's? :) > A TARDIS. and why it not ruled the world? :) -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskel

[Haskell-cafe] Installing ghc + gtk2hs on linux

2008-10-21 Thread Bulat Ziganshin
Hello haskell-cafe, i'm linux freshman what's the simplest way to install ghc + gtk2hs on Ubuntu x86 system? -- Best regards, Bulat mailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.h

Re[2]: [Haskell-cafe] Installing ghc + gtk2hs on linux

2008-10-21 Thread Bulat Ziganshin
Hello Ketil, Tuesday, October 21, 2008, 10:56:40 PM, you wrote: >> what's the simplest way to install ghc + gtk2hs on Ubuntu x86 system? > Untested, but try: > sudo apt-get install libghc6-gtk-dev thanks to everyone who answered. this one was shortest and it works. i don't tested other answ

Re: [Haskell-cafe] Re: A heretic question

2008-10-22 Thread Bulat Ziganshin
Hello Mauricio, Wednesday, October 22, 2008, 2:23:55 PM, you wrote: > Well, one thing I miss from C++ is the idea of acquiring resources in > constructors and releasing them in destructors, as explained here: > (Haskell uses that in 'with...' functions, like 'withFile', but the > syntax in C++ s

Re: [Haskell-cafe] External Sort: Sort a 10-million integer file with just 256M of ram.

2008-10-23 Thread Bulat Ziganshin
Hello Thomas, Thursday, October 23, 2008, 8:41:04 PM, you wrote: > The problem is not fitting a 10^8 element list in memory, the > following works fine > (when compiled, though not in ghci): > t = putStrLn . show . last $ [1..10^8::Int] this runs in 1k space, thanks to lazy evaluation. 10^8-len

Re[2]: [Haskell-cafe] Crash!

2008-10-23 Thread Bulat Ziganshin
Hello Andrew, Thursday, October 23, 2008, 11:42:04 PM, you wrote: > Theoretically, feeding invalid coordinates to the program might make it > run off the end of the IOUArray (or maybe off the beginning of it), but > I don't see what that has to do with GTK+... replace unsafe writes with simple o

Re: [Haskell-cafe] duplicate instance declarations. Why?

2008-10-24 Thread Bulat Ziganshin
Hello Alberto, Friday, October 24, 2008, 12:20:39 PM, you wrote: >>instance  R a => A a >>instance S a => A a >   > Duplicate instance declarations > Why? because you may write in other module instance R Int instance S Int if class A includes functions, it may be problematic to determine

Re[2]: [Haskell-cafe] External Sort: Sort a 10-million integer file with just 256M of ram.

2008-10-26 Thread Bulat Ziganshin
Hello Albert, Saturday, October 25, 2008, 9:02:14 PM, you wrote: > u = (putStrLn . show . last $ list) >> (putStrLn . show . head $ list) >where list = [1..10^8::Int] i prefer to write it as main = do let list = [1..10^8] print (last list) print (head list) -- Best reg

[Haskell-cafe] Re: [Haskell] IORef sharing

2008-10-27 Thread Bulat Ziganshin
Hello Rodney, Tuesday, October 28, 2008, 1:27:26 AM, you wrote: > Now I define an IORef and a couple of counters that share > the IORef, >> iio :: IO (IORef Int) >> iio = newIORef 0 >> ic1 = do { io <- iio ; count io 0 } >> ic2 = do { io <- iio ; count io 0 } > So apparently my mental picture

Re: [Haskell-cafe] Password hashing

2008-10-28 Thread Bulat Ziganshin
Hello Bit, Tuesday, October 28, 2008, 6:42:34 PM, you wrote: > What library can be used to securely hash passwords? From what I any secure hash, say SHA512 -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe

<    7   8   9   10   11   12   13   14   15   >