Re: [Haskell-cafe] Force -threaded from a library

2010-01-15 Thread Bulat Ziganshin
Hello John, Friday, January 15, 2010, 1:42:15 AM, you wrote: Is it possible to prevent a library from being used unless -threaded is enabled? I have a specific case where lots-of-nasty yes. it's how opposite checked in gtk2hs: when (rtsSupportsBoundThreads) $ fail $ \n ++ initGUI: Gtk+

Re: [Haskell-cafe] ANN: haskell-src-exts 1.7.0

2010-01-15 Thread Bulat Ziganshin
Hello Niklas, Friday, January 15, 2010, 10:57:55 PM, you wrote: * UnicodeSyntax now works not only for identifiers, but also for does this mean that unicode identifiers are allowed only when UnicodeSyntax enabled? ghc allows them anyway -- Best regards, Bulat

Re[2]: [Haskell-cafe] FFI, C/C++ and undefined references

2010-01-14 Thread Bulat Ziganshin
Hello Daniel, Thursday, January 14, 2010, 11:08:24 PM, you wrote: i think you are wrong. stdcall used for std windows dlls, but gcc by default generates ccall things. and cl anyway useless here Just an idea. Are you on windows? If so, then your foreign calls would probably have to be

Re[2]: [Haskell-cafe] FFI, C/C++ and undefined references

2010-01-14 Thread Bulat Ziganshin
Hello DNM, Thursday, January 14, 2010, 10:42:42 PM, you wrote: there is better way rather than playing with random bits. just find tutorial on FFI, and try it. once this example works, start modifying it to learn various aspects of ffi and add functionality you need it's one thing i've learned

Re: [Haskell-cafe] FFI, C/C++ and undefined references

2010-01-13 Thread Bulat Ziganshin
Hello DNM, Wednesday, January 13, 2010, 8:57:45 AM, you wrote: Note: I'm relatively new to Haskell, and my knowledge of C and C++ is basically pretty minimal -- I can read, modify and compile C/C++ programs (usually). 1. you use too much unsafePerformIO. since you need newCString, i suggest

Re: [Haskell-cafe] Name overloading

2010-01-13 Thread Bulat Ziganshin
Hello Cristiano, Wednesday, January 13, 2010, 9:43:06 PM, you wrote: coming up to my mind is that type inference actually forbids a type-directed resolution of names as in C++ or Java. you are right. we either have ad-hoc polymorphism like in C++ where type of id selected based on type of

Re[2]: [Haskell-cafe] Name overloading

2010-01-13 Thread Bulat Ziganshin
Hello John, Wednesday, January 13, 2010, 10:08:08 PM, you wrote: Of course, this doesn't allow you to have functions share the same name if they have different signatures class Open a where open :: a instance Open (Int - String) where ... instance Open (String - Int) where ... -- Best

Re[2]: [Haskell-cafe] FFI, C/C++ and undefined references

2010-01-13 Thread Bulat Ziganshin
Hello DNM, Thursday, January 14, 2010, 7:07:43 AM, you wrote: Yes, I thought of doing this, but then thought it was better to use a so-called managed foreign pointer via newForeignPtr. i recommend to use Ptr and switch to ForeignPtr only when you will study how to use it. overall, unsafe*

Re[2]: [Haskell-cafe] FFI, C/C++ and undefined references

2010-01-13 Thread Bulat Ziganshin
Hello Brandon, Thursday, January 14, 2010, 7:40:45 AM, you wrote: Really, the only reason in this case is that there is no equivalent for `extern C' that you can apply to a function definition, only to a declaration it works with GCC: extern C int c_szOpenArchive (TABI_ELEMENT* params) {

Re[2]: [Haskell-cafe] Language simplicity

2010-01-12 Thread Bulat Ziganshin
Hello Andrew, Wednesday, January 13, 2010, 1:54:44 AM, you wrote: (The material I quoted from had notes about which version of Java added certain of the words. I guess it was outdated.) you would be more respected in this list if you will compare haskell 1.0 with java'2010 or better '2020 ;)

Re: [Haskell-cafe] Typed Configuration Files

2010-01-08 Thread Bulat Ziganshin
Hello Sebastian, Friday, January 8, 2010, 3:53:53 PM, you wrote: Neil Mitchell's cmdargs package [1] is pretty neat. It can be used to parse command-line arguments into a user-defined data structure. Is there something similar for parsing config files? Lua language may be used to describe

Re: [Haskell-cafe] looking for origin of quote on preprocessors and language design

2010-01-07 Thread Bulat Ziganshin
Hello Johannes, Thursday, January 7, 2010, 3:32:03 PM, you wrote: the existence (or: need for) a preprocessor shows omissions in (the design of) a language. yes, that's the common opinion. the same true for comments and identifiers :D shortly speaking, preprocessor is just another language

Re[2]: [Haskell-cafe] looking for origin of quote on preprocessors and language design

2010-01-07 Thread Bulat Ziganshin
Hello Bulat, Thursday, January 7, 2010, 4:03:07 PM, you wrote: the existence (or: need for) a preprocessor shows omissions in (the design of) a language. forget to add: for language designers, analysis of typical preprocessor usage and adding analogous features to language instead is a great

Re[2]: [Haskell-cafe] Re: Distinct types in a list

2010-01-07 Thread Bulat Ziganshin
Hello Keith, Thursday, January 7, 2010, 11:26:51 PM, you wrote: existential types has more limited usage compared to dynamics, but in the cases they work they allow to have compile-time type-checking instead of run-time one Hello, My impression is that using existential types where possible

Re[2]: [Haskell-cafe] Template Haskell - substitution in pattern in a lambda

2010-01-04 Thread Bulat Ziganshin
Hello Patrick, Monday, January 4, 2010, 5:59:18 AM, you wrote: I'm guessing no such syntax exists? you are right. look at http://www.haskell.org/bz/th3.htm http://www.haskell.org/bz/thdoc.htm -- Best regards, Bulatmailto:bulat.zigans...@gmail.com

Re: [Haskell-cafe] setting seed for random numbers

2010-01-03 Thread Bulat Ziganshin
Hello Larry, Sunday, January 3, 2010, 8:46:30 PM, you wrote: Using seed-getSeed from the ghci command line works. Why doesn't it work in a script? because it's a feature of ghci command prompt, not haskell language. use smth like this: randList minval maxval = do seed - getSeed

Re: [Haskell-cafe] Dynamically Linking Foreign Functions

2009-12-31 Thread Bulat Ziganshin
Hello Richard, Thursday, December 31, 2009, 12:28:01 PM, you wrote: Problem: I don't understand how I can generate the foreign import statements at runtime. there are special C libraries that doest it. one of them is libffi, another one (can't recall its name) is used by ghc itself. libffi

Re[2]: [Haskell-cafe] Dynamically Linking Foreign Functions

2009-12-31 Thread Bulat Ziganshin
Hello Richard, C/Invoke is another library whose name i forget. Thanks a lot. Though the haskell wiki [0] claims that libffi works on x64. i don't know, just read yesterday on Lua list: A question for Fabio: what are the issues with Alien for 64-bit Windows? I can answer part of that.

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

2009-12-17 Thread Bulat Ziganshin
Hello michael, Thursday, December 17, 2009, 6:54:24 AM, you wrote: what is you see here is called association list. *function* array takes an index range and assoclist and returns an array. notice that data constructors are started with capital letter, f.e. Array

Re[8]: [Haskell-cafe] Boxed Mutable Arrays

2009-12-16 Thread Bulat Ziganshin
Hello Don, Wednesday, December 16, 2009, 7:27:29 PM, you wrote: The bug described in Ticket #650, AFAICS, prevents implementation of a reasonable, generic hash table in Haskell. :-( You can certainly implement it, it just requires that you increase the heap size to a bit bigger than your

Re: [Haskell-cafe] parallel and distributed haskell?

2009-12-16 Thread Bulat Ziganshin
Hello Scott, Wednesday, December 16, 2009, 10:21:51 PM, you wrote: Can anyone involved give a quick overview (or pointers to one)? GHC has great support for SMP systems. there is further work on parallel libraries and i believe that it was main part of HackPar. there are good serialization

Re[2]: [Haskell-cafe] Boxed Mutable Arrays

2009-12-15 Thread Bulat Ziganshin
Hello Don, Tuesday, December 15, 2009, 10:42:01 AM, you wrote: How about a fast STHashTable? you can use array of arrays instead of large array Note to minmize the issue, but we get many of the same benefits via the associated type transformation (e.g. for arrays of

Re[4]: [Haskell-cafe] Boxed Mutable Arrays

2009-12-15 Thread Bulat Ziganshin
Hello Brad, Tuesday, December 15, 2009, 6:53:14 PM, you wrote: How about a fast STHashTable? you can use array of arrays instead of large array Can you elaborate? what exactly? how to implement this or why it will be faster? -- Best regards, Bulat

Re[6]: [Haskell-cafe] Boxed Mutable Arrays

2009-12-15 Thread Bulat Ziganshin
Hello Brad, Tuesday, December 15, 2009, 7:16:18 PM, you wrote: You said to use an array of arrays instead of a large array, in the context of a fast hash table in ST. Do you mean I should use an array for hash buckets, rather than a list? Is that what you meant? And why would it be

Re[2]: [Haskell-cafe] Boxed Mutable Arrays

2009-12-15 Thread Bulat Ziganshin
Hello Alberto, Tuesday, December 15, 2009, 5:23:41 PM, you wrote: ST monad is the same as IO monad modulo type trickery. tris trickery allows to limit imperative operations available inside ST monad to STRef/STArray manipulations which is guaranteed to be referential-transparent as part of this

Re: [Haskell-cafe] getting data through foreign layer without marshalling

2009-12-14 Thread Bulat Ziganshin
Hello Donn, Monday, December 14, 2009, 4:31:58 AM, you wrote: I'm just not sure where AppData lives while it's referenced in a FunPtr via partial application, if there might be multiple copies, etc. GHC RTS creates thunk with this partial call. this thunk references all the data used in

Re[2]: [Haskell-cafe] Re: How Can Haskell Be Saved?

2009-12-14 Thread Bulat Ziganshin
Hello Erik, Monday, December 14, 2009, 5:44:22 AM, you wrote: I also pointed out that Windows NT had a fully compliant POSIX subsystem, by design, and that Microsoft cared at least enough about POSIX support to buy the company that made what is now SUA. How does that explain things like

Re[4]: [Haskell-cafe] Re: How Can Haskell Be Saved?

2009-12-14 Thread Bulat Ziganshin
Hello Erik, Monday, December 14, 2009, 1:02:58 PM, you wrote: POSIX is a *subsystem*. you are using Win32 subsystem. There is also Please enlighten me. How do I access the POSIX subsystem? i don't know since i never tried. it seems that this is bad idea. if you really need it, it should be

Re[4]: [Haskell-cafe] Re: How Can Haskell Be Saved?

2009-12-14 Thread Bulat Ziganshin
Hello Duncan, Monday, December 14, 2009, 1:33:14 PM, you wrote: Please enlighten me. How do I access the POSIX subsystem? I'm not sure of all the details, but the program ends up getting linked differently. The GNU ld user guide says: yes, it should be linked to other dlls. the catch is

Re[6]: [Haskell-cafe] Re: How Can Haskell Be Saved?

2009-12-14 Thread Bulat Ziganshin
Hello Erik, Monday, December 14, 2009, 1:27:12 PM, you wrote: It seems the POSIX subsystem was POSIX.1 only and was removed completely in windows XP. Thats not a solution. yes, i mean the same. just don't mix up fseek() in your C compiler with windows POSIX implementation POSIX subsystem

Re[2]: [Haskell-cafe] Boxed Mutable Arrays

2009-12-14 Thread Bulat Ziganshin
Hello Brad, Tuesday, December 15, 2009, 1:55:41 AM, you wrote: How about a fast STHashTable? you can use array of arrays instead of large array -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe

Re: [Haskell-cafe] Fwd: [BostonHaskell] Next meeting: December 17th at MIT (32-G882)

2009-12-12 Thread Bulat Ziganshin
Hello Ravi, Saturday, December 12, 2009, 9:48:28 AM, you wrote: Based on the responses to my previous message, our featured presenter will be Ryan Newton who will talk about the Intel Concurrent Collections for Haskell. awesome! you may try it on many typical unix text processing tasks, such

Re[2]: [Haskell-cafe] Re: ANN: hakyll-0.1

2009-12-12 Thread Bulat Ziganshin
Hello Stephen, Saturday, December 12, 2009, 3:32:09 PM, you wrote: the GPL would apply. Distribution being the key point, as at that your mileage may vary, etcetera. Similar the limits on 'client' would need some definition vis-a-vis distribution, one person would surely be fine,

[Haskell-cafe] killer app, again

2009-12-10 Thread Bulat Ziganshin
Hello Sebastian, Thursday, December 10, 2009, 4:27:49 PM, you wrote: The killer app for that, IMO, is parallelism these days btw, are you seen Google App Engine? it's python/java ATM, but i think that haskell will be ideal fit there. it's all about computations-in-cloud, or more precisely

Re[2]: [Haskell-cafe] Lisp like symbols in haskell

2009-12-08 Thread Bulat Ziganshin
Hello Michael, Tuesday, December 8, 2009, 11:48:09 AM, you wrote: Do you mean symbols as in interned strings with an O(1) string comparison method? I would love to have those, but I don't see an easy way to get it without being in the IO or ST monad. you could intern IO usage with

Re[2]: [Haskell-cafe] A bug of groupBy implement

2009-12-07 Thread Bulat Ziganshin
Hello Stephen, Monday, December 7, 2009, 8:11:01 PM, you wrote: it's just what goupBy compares with the first element of group rather than comparing two adjancent elements. look at the trace it's not a bug, but misunderstanding of specification :) Could it not be a bug in a) printf b)

Re: [Haskell-cafe] The Haskell Web News: December 2009 Edition

2009-12-07 Thread Bulat Ziganshin
Hello Don, Monday, December 7, 2009, 8:16:25 PM, you wrote: http://haskellwebnews.wordpress.com/2009/12/05/whats-new-in-haskell-december-2009/ can we make download counts for individual packages available? my own program (http://freearc.org) has about 10k downloads/month so i doubt what place

Re[2]: [Haskell-cafe] Low Level Audio - Writing bytes to the sound card?

2009-12-06 Thread Bulat Ziganshin
Hello Andrew, Sunday, December 6, 2009, 1:09:18 AM, you wrote: Maybe once I get hired by some financial modelling consultants and get paid shedloads of money to write Haskell all day, I'll be able to afford a Mac. But until then... with such attitude you will never be hired by financial

Re: [Haskell-cafe] HP + Gtk2hs?

2009-12-05 Thread Bulat Ziganshin
Hello Andrew, Saturday, December 5, 2009, 6:40:23 PM, you wrote: prominent?) Somebody pointed out this bug 6 months ago. Somebody else posted a potential fix a month ago. There is no visible activity from the developers. Developer. many Haskell problems is due to the fact that we have a few

Re[2]: [Haskell-cafe] HP + Gtk2hs?

2009-12-05 Thread Bulat Ziganshin
Hello Andrew, Saturday, December 5, 2009, 10:14:17 PM, you wrote: I did try to get wxHaskell going once or twice. And the SDL binding. (I wasn't aware we have Qt now...) I've never got any of them to work yet. it depends on when you have tried. wx made significant progress in last year or two

Re: [Haskell-cafe] Optimization with Strings ?

2009-12-03 Thread Bulat Ziganshin
Hello Emmanuel, Thursday, December 3, 2009, 3:03:02 PM, you wrote: memory footprint and is easier. But I don't know if it worth to do this optimization: having a dictionary to translate string words in Int. GHC compiler already has this optimization. unfortunately it's not in the code it

Re[2]: [Haskell-cafe] Optimization with Strings ?

2009-12-03 Thread Bulat Ziganshin
Hello Emmanuel, Thursday, December 3, 2009, 6:23:56 PM, you wrote: that forall x; List x = x==x. GHC have all informations to do this optimization job, because haskell functions definitions are mathematics definitions. GHC doesn't make ALL possible optimizations, isn't it obvious? ;) --

Re: [Haskell-cafe] License question

2009-11-30 Thread Bulat Ziganshin
Hello jean-christophe, Monday, November 30, 2009, 11:43:00 AM, you wrote: I am writing a port to F# of some haskell standard libraries. www.haskell.org is under the simple permissive license.  Does this license also cover the souce code available from that site? the license cover only Wiki

Re[2]: [Haskell-cafe] License question

2009-11-30 Thread Bulat Ziganshin
Hello Malcolm, Monday, November 30, 2009, 1:45:29 PM, you wrote: And in fact the official Haskell'98 libraries are covered by an even more permissive license: that of the Language Report. The authors intend this Report to belong to the entire Haskell community, and so we grant permission

Re: [Haskell-cafe] Help mixing pure and IO code

2009-11-29 Thread Bulat Ziganshin
Hello papa, Sunday, November 29, 2009, 5:11:23 PM, you wrote: add some IO on top of it, keeping the main code pure. The idea was to write a very simple two-player game, then define some strategies to play it that do not involve IO ho i could do it: class Strategy state where initState ::

Re: [Haskell-cafe] peekCString free memory

2009-11-29 Thread Bulat Ziganshin
Hello El, Sunday, November 29, 2009, 8:00:02 PM, you wrote: segfault is due to free, you may omit peekCString call. you should free only memory that was malloced and not freed other way Hello, I get a segfault when I do str - peekCString ptr free ptr return (Just str) But not when I

Re: [Haskell-cafe] haskell in online contests

2009-11-27 Thread Bulat Ziganshin
Hello vishnu, Friday, November 27, 2009, 10:41:37 PM, you wrote: it's just false assumption that you should got speed comparable to other languages. haskell is lazy and ghc has much less mature compiler Ive just started learning haskell pretty recently and Ive been trying to solve some

Re[2]: [Haskell-cafe] haskell in online contests

2009-11-27 Thread Bulat Ziganshin
Hello Don, Friday, November 27, 2009, 11:08:44 PM, you wrote: it's just false assumption that you should got speed comparable to other languages. haskell is lazy and ghc has much less mature compiler comparable to other languages eh? That seems a little too broad to be meaningful, Bulat, as

Re[2]: [Haskell-cafe] Re: Idea for a very simple GUI llibrary

2009-11-23 Thread Bulat Ziganshin
Hello Juan, Monday, November 23, 2009, 7:01:39 PM, you wrote: But in HUGS i can't. It says: ERROR conjunction.hs:1 - Unrecognised character `\8743' hugs doesn't accept unicode source files there are lots of unicode support problems in both haskell implementations. probably we have some wiki

Re: [Haskell-cafe] Re: ANNOUNCE: deepseq-1.0.0.0

2009-11-18 Thread Bulat Ziganshin
Hello Simon, Wednesday, November 18, 2009, 12:17:31 PM, you wrote: You could argue that (a - b - b) is doing more than (a - ()), if i correctly understand, we have two versions: 1) easier to use 2) more efficient and one of them may be defined via another? how about providing both versions,

Re: [Haskell-cafe] Simple hash table creation

2009-11-17 Thread Bulat Ziganshin
Hello michael, Tuesday, November 17, 2009, 10:16:50 PM, you wrote: I'm trying to create a hash table. Yeah, I know, don't use hash tables, but I need to create something I'm familiar with, not something I've never worked with before. What's wrong with this code? ht = MyHashTable.new (==)

Re[2]: [Haskell-cafe] Simple hash table creation

2009-11-17 Thread Bulat Ziganshin
Hello Daniel, Tuesday, November 17, 2009, 11:21:18 PM, you wrote: The hash function must have a return type of fixed and specified width, or porting the app between 32-bit and 64-bit platforms could have enormous performance impact, so it can't be plain Int. i think that the problem with

Re[2]: [Haskell-cafe] Simple hash table creation

2009-11-17 Thread Bulat Ziganshin
Hello michael, Wednesday, November 18, 2009, 12:00:58 AM, you wrote: *Main toList ht [(miguel,3),(michael,2),(mike,1)] It seems my dummy function is being ignored. i wonder why you think so? your ht has all 3 pairs you ever inserted inside, they all are inside the same bucket since hash

Re[2]: [Haskell-cafe] Howto start a bigger project

2009-11-16 Thread Bulat Ziganshin
Hello Casey, Monday, November 16, 2009, 11:30:51 PM, you wrote: Why not use www.sourceforge.net? i strongly recommend http://code.google.com or http://codeplex.com SF is slow and olf-fashioned -- Best regards, Bulatmailto:bulat.zigans...@gmail.com

Re: [Haskell-cafe] Where is a good place to place code like this, so if I may be so bold, people can learn from it?

2009-11-14 Thread Bulat Ziganshin
Hello Casey, Saturday, November 14, 2009, 9:15:51 PM, you wrote: Where is a good place to place code like this, so if I may be so bold, people can learn from it? the solution i've seen in 80's was: main = print (solutions 8 8) solutions n 0 = [[]] solutions n k = [(i,k):xs | xs - solutions

Re: [Haskell-cafe] Little errors in number calculations

2009-11-14 Thread Bulat Ziganshin
Hello Abby, Sunday, November 15, 2009, 12:00:42 AM, you wrote: I understand that error may (and will) happen in floating point, but it surprises me that they do so easily, and, above all, the difference between GHC and Hugs. Does someone know why does this difference occur? compare:

Re[2]: [Haskell-cafe] faster compiling for ghc

2009-11-12 Thread Bulat Ziganshin
Hello David, Thursday, November 12, 2009, 10:22:41 AM, you wrote: are you seen hugs, for example? i think that ghc is slow because it's written in haskell and compiled by itself If I understood, Evan is interested in ideas to speed up compilation. As far as I know, hugs is an interpreter,

Re[2]: [Haskell-cafe] faster compiling for ghc

2009-11-12 Thread Bulat Ziganshin
Hello Neil, Thursday, November 12, 2009, 1:57:06 PM, you wrote: I'd really love a faster GHC! there are few obvious ideas: 1) use Binary package for .hi files 2) allow to save/load bytecode 3) allow to run program directly from .hi files w/o linking 4) save mix of all .hi files as program

Re: [Haskell-cafe] Resource compilation in GHC

2009-11-12 Thread Bulat Ziganshin
Hello Konstantin, Thursday, November 12, 2009, 1:12:35 PM, you wrote: I'm writing an wxHaskell application. Everything is ok, but now I need a separate folder for icons, bitmaps, and so on, from where they are loaded at runtime. How can I compile resources, and link them into my executable

Re[2]: [Haskell-cafe] faster compiling for ghc

2009-11-12 Thread Bulat Ziganshin
Hello Rafal, Thursday, November 12, 2009, 3:10:54 PM, you wrote: it's impossible to interpret haskell - how can you do type inference? hugs, like ghci, is bytecode interpreter. the difference is their implementation languages - haskell vs C We use Standard ML for the Isabelle/HOL theorem

Re[2]: [Haskell-cafe] faster compiling for ghc

2009-11-12 Thread Bulat Ziganshin
of next cl iterations should only depend on the number of changes one does, not on the total project size. On Thu, Nov 12, 2009 at 1:10 PM, Rafal Kolanski x...@xaph.net wrote: Bulat Ziganshin wrote: it's impossible to interpret haskell - how can you do type inference? hugs, like ghci, is bytecode

Re: [Haskell-cafe] Sometimes pinned memory?

2009-11-11 Thread Bulat Ziganshin
Hello Gregory, Thursday, November 12, 2009, 12:14:56 AM, you wrote: Hey everyone! Do you have any suggestions for how I might allocate an aligned block of memory that I can pin while making foreign calls, but leave unpinned the rest of the time to potentially improve allocation and garbage

Re: [Haskell-cafe] faster compiling for ghc

2009-11-11 Thread Bulat Ziganshin
Hello Evan, Thursday, November 12, 2009, 4:02:17 AM, you wrote: Recently the go language was announced at golang.org. There's not a lot in there to make a haskeller envious, except one real big one: compilation speed. The go compiler is wonderfully speedy. are you seen hugs, for example? i

Re[2]: [Haskell-cafe] What's the deal with Clean?

2009-11-04 Thread Bulat Ziganshin
Hello Don, http://shootout.alioth.debian.org/u64q/benchmark.php?test=alllang=ghclang2=cleanbox=1 http://shootout.alioth.debian.org/u64q/benchmark.php?test=alllang=ghclang2=ocamlbox=1 The Haskell compiler isn't the bottleneck. Use it when performance matters. I do. Don, shootout times may

Re[2]: [Haskell-cafe] What's the deal with Clean?

2009-11-04 Thread Bulat Ziganshin
Hello Ketil, Wednesday, November 4, 2009, 4:31:20 PM, you wrote: Well, it clearly demonstrates that it is possible to write fast code in Haskell. my measures says that by psending 3x more time than for C you can optimize haskell code to be only 3x slower than C one succinct and correct

Re[4]: [Haskell-cafe] What's the deal with Clean?

2009-11-04 Thread Bulat Ziganshin
Hello Alberto, Wednesday, November 4, 2009, 5:58:31 PM, you wrote: I personally don´t care about raw performance. me too. actually, i write time-critical parts of my app in c++ Haskell is in the top of the list of language performance. this list is meaningless, as i said before It has

Re[2]: [Haskell-cafe] What's the deal with Clean?

2009-11-04 Thread Bulat Ziganshin
Hello Ketil, Wednesday, November 4, 2009, 7:43:38 PM, you wrote: Right?, the interesting thing is not how fast I can get with N times the effort, but if I can get fast enough with 1/N. it depends entirely on how fast you need. so it's again changing the topic - while i say that haskell is

Re: [Haskell-cafe] Re: How to optimize the performance of a code in Haskell?

2009-11-04 Thread Bulat Ziganshin
Hello Kalman, Wednesday, November 4, 2009, 7:53:49 PM, you wrote: I've not looked at the code, but you'll want ghc to do better optimizations than -O. -O2 is what you should use in general. Also, number-crunching often profits from -fexcess-precision. also, floating-point number crunching

Re: [Haskell-cafe] Simple FAST lazy functional primes

2009-11-02 Thread Bulat Ziganshin
Hello Will, Monday, November 2, 2009, 10:41:15 AM, you wrote: (testing was done running the ghc -O3 compiled code inside GHCi). afaik, -O2 should be used -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___

Re[2]: [Haskell-cafe] Is there a null statement that does nothing?

2009-10-27 Thread Bulat Ziganshin
Hello Kim-Ee, Tuesday, October 27, 2009, 8:08:27 PM, you wrote: Just for completeness' sake, bottom is a value for any expression. Wouldn't making the else clause optional by defaulting to undefined worthy of consideration for Evil Haskell? in this case you will get an exception when

Re[2]: [Haskell-cafe] Fortran mixed mode arithmetic expressions - Haskell

2009-10-26 Thread Bulat Ziganshin
Hello michael, Monday, October 26, 2009, 7:24:46 PM, you wrote: afair, ** and ^ are different - one is for integers, another for floating-point numbers Hi Brandon, Being new to Haskell, I take it (^) and (^^) would be the preferred exponential operator. When (how,where,why) would one use

Re[2]: [Haskell-cafe] Re: Libraries for Commercial Users

2009-10-25 Thread Bulat Ziganshin
Hello Colin, Sunday, October 25, 2009, 7:59:54 PM, you wrote: developers, I would probably find it very difficult indeed to find another job as an Eiffel developer, so I would have to look elsewhere, Haskell developers have another risk - they may be considered as overqualified for doing

Re: [Haskell-cafe] Lazy problem ?

2009-10-23 Thread Bulat Ziganshin
Hello zaxis, Friday, October 23, 2009, 11:15:01 AM, you wrote: good_ssq_red = withFile ssqHitNum.txt ReadMode (\h - do { samp - fmap str2Ints $ hGetContents h; print samp;--without this line, the result will always [1..16] return $ statis samp; }) withFile

Re[2]: [Haskell-cafe] Lazy problem ?

2009-10-23 Thread Bulat Ziganshin
ssqHitNum.txt; return $ statis samp; } It works now ! thank you Bulat Ziganshin-2 wrote: Hello zaxis, Friday, October 23, 2009, 11:15:01 AM, you wrote: good_ssq_red = withFile ssqHitNum.txt ReadMode (\h - do { samp - fmap str2Ints $ hGetContents h; print samp

Re[2]: [Haskell-cafe] Is there a null statement that does nothing?

2009-10-22 Thread Bulat Ziganshin
Hello michael, Thursday, October 22, 2009, 4:59:43 AM, you wrote: return () does the trick if another branch also returns () Thanks guys, I understand what you're telling me, but have some nested IFs and just want to fall through on one of the ELSES but then I end up with two ELSES in a

Re: [Haskell-cafe] How can i safely change the value of specified key ?

2009-10-22 Thread Bulat Ziganshin
Hello zaxis, Thursday, October 22, 2009, 11:28:14 AM, you wrote: aaa - newIORef ([]::[(Int,Int)]) writeIORef aaa [(1,1),(2,2),(3,3)] then if i want to change aaa to [(1,1),(2,222),(3,3)] , what's the best way ? re-write aaa is not permitted. it's the only way. in Haskell, you have

Re: [Haskell-cafe] How can i safely change the value of specified key ?

2009-10-22 Thread Bulat Ziganshin
Hello zaxis, Thursday, October 22, 2009, 11:28:14 AM, you wrote: then if i want to change aaa to [(1,1),(2,222),(3,3)] , what's the best way ... well, anyway what you are doing isn't very haskellish. it may be considered as advanced topic but basically, best way to compute something in Haskell

Re[2]: [Haskell-cafe] How can i safely change the value of specified key ?

2009-10-22 Thread Bulat Ziganshin
; send_backP pipe (buf,len)) yes, it's imperative but it includes several lambdas per each line Bulat Ziganshin-2 wrote: Hello zaxis, Thursday, October 22, 2009, 11:28:14 AM, you wrote: aaa - newIORef ([]::[(Int,Int)]) writeIORef aaa [(1,1),(2,2),(3,3)] then if i want to change aaa to [(1,1

Re[2]: [Haskell-cafe] How can i safely change the value of specified key ?

2009-10-22 Thread Bulat Ziganshin
Hello zaxis, Thursday, October 22, 2009, 1:03:21 PM, you wrote: Is [(1,1),(2,2),(3,3)] been regarded as a hash ? If not, what is the best way to change it to [(1,1),(2,),(3,3)] in function `f` ? f = map (\x@(a,b) - if a==2 then (a,) else x) or f xs = [(a, if a==2 then else b) |

Re: [Haskell-cafe] x - String

2009-10-16 Thread Bulat Ziganshin
Hello Andrew, Friday, October 16, 2009, 10:19:46 PM, you wrote: actually print out what's in it. On the other hand, I don't want to alter the entire program to have Show constraints everywhere just so I can print out some debug traces (and then alter everything back again afterwards once I'm

Re: [Haskell-cafe] GHC devs

2009-10-14 Thread Bulat Ziganshin
Hello Andrew, Wednesday, October 14, 2009, 10:28:45 PM, you wrote: I had always *assumed* that there was something like a hundred core developers only 10 and only in binary system :))) Simon Peyton-Jones works on front-end, i.e compiling Haskell down to simple core language, and Simon Marlow

Re[2]: [Haskell-cafe] GHC devs

2009-10-14 Thread Bulat Ziganshin
Hello Andrew, Thursday, October 15, 2009, 12:54:37 AM, you wrote: Does anybody actually get paid to develop GHC? Or is this all people SPJ, SM and Ian are paid by MS Research. Other people involved in core development are mainly scientists (afaik) -- Best regards, Bulat

Re[2]: [Haskell-cafe] ANN: text 0.5, a major revision of the Unicode text library

2009-10-11 Thread Bulat Ziganshin
Hello Neil, Sunday, October 11, 2009, 5:58:51 PM, you wrote: I had a crack at a simple proper Data instance, and got as far as needing a Data instance for ByteString#, accompanied by an error I don't impossible. i'm not sure wher i've read this but those # types (Int#, ByteArray# and so on)

Re[2]: [Haskell-cafe] type inference question

2009-10-08 Thread Bulat Ziganshin
Hello Cristiano, Thursday, October 8, 2009, 7:14:20 PM, you wrote: Could you explain why, under NoMonomorphismRestriction, this typechecks: let a = 1 in (a + (1 :: Int),a + (1 :: Float)) while this not: foo :: Num a = a - (Int,Float) foo k = (k + (1 :: Int), k + (1.0 :: Float)) i think

Re[2]: [Haskell-cafe] Creating an alias for a function

2009-10-07 Thread Bulat Ziganshin
Hello Ross, Wednesday, October 7, 2009, 6:02:28 AM, you wrote: car = head unfortunately it doesn't work without -fno-monomorphism-restriction -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe

Re[4]: [Haskell-cafe] Creating an alias for a function

2009-10-07 Thread Bulat Ziganshin
Hello Luke, Wednesday, October 7, 2009, 11:35:47 AM, you wrote: car = head unfortunately it doesn't work without -fno-monomorphism-restriction It should be fine without the monomorphism restriction. Said restriction only applies to functions with typeclass constraints, of which this has

Re[2]: [Haskell-cafe] better way to do this?

2009-10-07 Thread Bulat Ziganshin
Hello Peter, Wednesday, October 7, 2009, 2:04:49 PM, you wrote: afair, nhc was started there. it was a small compiler exactly because Amiga was a rather small computer (comapred to RISC stations) Yep. Commodore 64, Amiga. I really loved those machined, especially the Amiga (mmm, maybe someone

Re[6]: [Haskell-cafe] Creating an alias for a function

2009-10-07 Thread Bulat Ziganshin
Hello Deniz, Wednesday, October 7, 2009, 5:03:59 PM, you wrote: it depends. what i see with ghc 6.6.1: C:\!\Haskellrunghc test.hs test.hs:1:6: Ambiguous type variable `a' in the constraint: `Enum a' arising from use of `fromEnum' at test.hs:1:6-13 Possible cause: the monomorphism

Re[8]: [Haskell-cafe] Creating an alias for a function

2009-10-07 Thread Bulat Ziganshin
Hello Deniz, Wednesday, October 7, 2009, 5:23:24 PM, you wrote:    Possible cause: the monomorphism restriction applied to the following:      ord :: a - Int (bound at test.hs:1:0)    Probable fix: give these definition(s) an explicit type signature                  or use

Re: [Haskell-cafe] Is c2hs able to generate FunPtr rather than just the function?

2009-10-05 Thread Bulat Ziganshin
Hello Rafal, Monday, October 5, 2009, 9:18:30 AM, you wrote: Is there a neat way to have c2hs generate the FunPtr version for me? from my program: -- |My callback function type type CALLBACK_FUNC = Ptr CChar - IO CInt foreign import ccall threadsafe wrapper mkCALL_BACK :: CALLBACK_FUNC

Re: [Haskell-cafe] convert a list of booleans into Word*

2009-09-30 Thread Bulat Ziganshin
Hello Paul, Wednesday, September 30, 2009, 1:18:03 PM, you wrote: I haven't found a function in hackage or in the standard library that takes a list of booleans (or a list of 0s and 1s, or a tuple of booleans or 0s and 1s) and outputs a Word8 or Word32. sum . zipWith (*) (map (2^) [0..])

Re[2]: [Haskell-cafe] Any generic serializer to String? was: Any working example of using genericserialize?

2009-09-30 Thread Bulat Ziganshin
Hello Max, Wednesday, September 30, 2009, 5:53:37 PM, you wrote: afaik, SYB just provides gshow/gread functions what serialize any Data instance to String FWIW, writing your own is not hard. I wrote a serializer for GHC using Data in less than 150 (simple) LOC. It produces [Word8], but

Re: [Haskell-cafe] Comments requested: succ Java

2009-09-28 Thread Bulat Ziganshin
Hello Curt, Sunday, September 27, 2009, 8:16:53 PM, you wrote: http://www.starling-software.com/en/blog/drafts/2009/09/27.succ-java-summary.html what are the types of balance and interest in balance * interest expression? ;) -- Best regards, Bulat

Re[2]: [Haskell-cafe] A proposals

2009-09-28 Thread Bulat Ziganshin
Hello Martijn, Monday, September 28, 2009, 1:42:10 PM, you wrote: Another nice thing this suggests is the ability to use underscore as a pattern for when you know the compiler will infer the type but it's too complex to want to write out (e.g. while experimenting). in case you not seen

Re[2]: [Haskell-cafe] Comments requested: succ Java

2009-09-28 Thread Bulat Ziganshin
Hello Edward, Monday, September 28, 2009, 6:26:12 PM, you wrote: If you have counterexamples, then perhaps you can name them. I'm looking for Java shops with 5+ developers and code bases of 100k converting over to Haskell. I don't know _any such shop_ that has switched to Haskell, and I

Re[2]: [Haskell-cafe] How does one delare a 2D STUArray in Haskell?

2009-09-25 Thread Bulat Ziganshin
Hello Casey, Friday, September 25, 2009, 11:22:25 AM, you wrote: Well that makes sense, but for a learner, how is he/she supposed to know that 'i' could be '(i,i)' or for that matter a tuple of n of those i's? look at Ix class instances:

Re: [Haskell-cafe] Ctrl-C handling in Haskell with curl on Linux

2009-09-24 Thread Bulat Ziganshin
Hello Vasyl, Thursday, September 24, 2009, 1:30:46 PM, you wrote: I couldn't find any solutions to this problem, I am afraid that this problem could occur in other non-native haskell modules (bindings to C libraries) look at GHC.ConsoleHandler module -- Best regards, Bulat

Re[2]: [Haskell-cafe] accessible layout proposal?

2009-09-23 Thread Bulat Ziganshin
Hello Jimmy, Wednesday, September 23, 2009, 11:11:58 AM, you wrote: How about this (which I believe to be backwards compatible): brilliant! -- Best regards, Bulatmailto:bulat.zigans...@gmail.com ___ Haskell-Cafe

Re: [Haskell-cafe] Bug in writeArray?

2009-09-23 Thread Bulat Ziganshin
Hello Grzegorz, Wednesday, September 23, 2009, 7:19:59 PM, you wrote: This seems like a bug in the implementation of writeArray: when passed let (l,u) = ((0,10),(20,20)) writeArray computes raw index (from 0 to total number of array elements) and check that this index is correct. with

Re: [Haskell-cafe] Status of GHC as a Cross Compiler

2009-09-23 Thread Bulat Ziganshin
Hello John, Wednesday, September 23, 2009, 10:50:24 PM, you wrote: This may be more appropriate for a different list, but I'm having a hard time figuring out whether or not we're getting a cross compiler in 6.12 or not. Can some one point me to the correct place in Traq to find this

<    1   2   3   4   5   6   7   8   9   10   >