Re[2]: [Haskell-cafe] Umlauts in command line arguments

2009-06-01 Thread Bulat Ziganshin
Hello Gwern, Monday, June 1, 2009, 4:35:25 AM, you wrote: > GHC mangles UTF by default. You probably want to use one of the utf8 > packages; eg. > http://hackage.haskell.org/cgi-bin/hackage-scripts/package/utf8-string > or > http://hackage.haskell.org/cgi-bin/hackage-scripts/package/utf8-light >

Re: [Haskell-cafe] GUI and background processing

2009-06-01 Thread Bulat Ziganshin
Hello Dmitry, Monday, June 1, 2009, 4:24:36 PM, you wrote: > All network operations are run in separate thread, but sometimes input > from user is needed. Afaik, gtk2hs is not thread safe, so I came up with look for postGUISync and postGUIASync -- Best regards, Bulat

Re: [Haskell-cafe] Compiling a windows app - embedding application icon

2009-06-02 Thread Bulat Ziganshin
Hello Gu?nther, Tuesday, June 2, 2009, 4:47:55 PM, you wrote: > is it possible to make ghc embedd an application icon in the .exe during > the compilation process? i've found that answer may be googled as "gcc icon": 1) create icon.rc containing one line: 100 ICON "freearc.ico" 2) compile it u

Re: [Haskell-cafe] Compiling a windows app - embedding a manifest

2009-06-02 Thread Bulat Ziganshin
Hello Gu?nther, Wednesday, June 3, 2009, 12:11:15 AM, you wrote: > Hi all, > is it possible to make ghc embedd a particular manifest in the .exe > during the compilation process? add to .rc file: 1 24 "app.manifest" and put manifect into app.manifest -- Best regards, Bulat

Re[2]: [Haskell-cafe] Umlauts in command line arguments

2009-06-05 Thread Bulat Ziganshin
Hello Eric, Friday, June 5, 2009, 12:17:42 AM, you wrote: >> I'm using ghc 6.10.2 on Win XP. Are there any known solutions for this >> problem? > Your question has inspired me to add a System.Environment.UTF8 module > to utf8-string 0.3.5 > This module behaves like the System.IO.UTF8 wrapper.

Re: [Haskell-cafe] Change value of a variable

2009-06-07 Thread Bulat Ziganshin
Hello ptrash, Sunday, June 7, 2009, 9:41:56 PM, you wrote: > Hi, how can I change the value of a variable. there are no variables in haskell :))) x, like any other identifier, is a value. when you translate to Haskell some algo that needs to update variable contents, you may either 1) use recu

Re[2]: [Haskell-cafe] Change value of a variable

2009-06-07 Thread Bulat Ziganshin
Hello ptrash, Sunday, June 7, 2009, 11:03:55 PM, you wrote: > Hi, thanks for the answers. > I want to make something like a counter. I have written a recursive method > which for example runs x times and counts how many times it runs, and also > count some other thinks. Add the end I want a stat

Re[2]: [Haskell-cafe] Change value of a variable

2009-06-07 Thread Bulat Ziganshin
Hello ptrash, Sunday, June 7, 2009, 11:44:18 PM, you wrote: > I have a list of pupils (type Pupil = (Name, Grade)) where I store the name > of the pupil and which grade he has. No I want to get the number (and > average number) of each grade. Something like 10 Pupils have a A (23%), 2 > Pupils ha

Re[2]: [Haskell-cafe] Convert IO Int to Int

2009-06-09 Thread Bulat Ziganshin
Hello jerzy, Tuesday, June 9, 2009, 8:23:04 PM, you wrote: > Please, tell him first about random streams, which he can handle without > IO. Or, about ergodic functions (hashing contraptions which transform ANY > parameter into something unrecognizable). When he says : "I know all that", > THEN hu

Re: [Haskell-cafe] Unicode workaround for getDirectoryContents under Windows?

2009-06-13 Thread Bulat Ziganshin
Hello Shu-yu, Sunday, June 14, 2009, 7:41:46 AM, you wrote: > It seems like getDirectoryContents applies codepage conversion based it's not a bug, but old-fashioned architecture of entire file apis you may find my Win32Files.hs module useful - it adopts UTF-16 versions of file operations http:

Re: [Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

2009-06-16 Thread Bulat Ziganshin
Hello Simon, Tuesday, June 16, 2009, 3:30:31 PM, you wrote: > Care to submit a patch to put this in System.Directory, or better still > put the relevant functionality in System.Win32 and use it in > System.Directory? Simon, it will somewhat broke openFile. let's see. there are 3 types of filena

Re[2]: [Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

2009-06-16 Thread Bulat Ziganshin
Hello Simon, Tuesday, June 16, 2009, 4:34:29 PM, you wrote: > Thanks for reminding me that openFile is also broken. It's easily > fixed, so I'll look into that. i fear that it will leave GHC libs in inconsistent state that can drive users mad. now at least there are some rules of brokeness. whe

Re[2]: [Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

2009-06-16 Thread Bulat Ziganshin
Hello Simon, Tuesday, June 16, 2009, 5:02:43 PM, you wrote: > Also currently broken: > * calling removeFile on a FilePath you get from getDirectoryContents, > amongst other System.Directory operations > Fixing getDirectoryContents will fix these. no. removeFile like anything else also us

Re[2]: [Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

2009-06-16 Thread Bulat Ziganshin
Hello Simon, Tuesday, June 16, 2009, 7:30:55 PM, you wrote: > Actually we use a mixture of CRT functions and native Windows API, > gradually moving in the direction of the latter. so file-related APIs are already unpredictable, and will remain in this state for unknown amount of ghc versions -

Re[2]: [Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

2009-06-16 Thread Bulat Ziganshin
Hello Simon, Tuesday, June 16, 2009, 7:54:02 PM, you wrote: > In fact there's not a lot left to convert in System.Directory, as you'll > see if you look at the code. Feel like helping? these functions used there are ACP-only: c_stat c_chmod System.Win32.getFullPathName c_SearchPath c_SHGetFold

Re[2]: [Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

2009-06-16 Thread Bulat Ziganshin
Hello Simon, Tuesday, June 16, 2009, 5:02:43 PM, you wrote: > I don't know how getArgs fits in here - should we be decoding argv using > the ACP? myGetArgs = do alloca $ \p_argc -> do p_argv_w <- commandLineToArgvW getCommandLineW p_argc argc <- peek p_argc argv_w <- peekArray

Re[2]: [Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

2009-06-17 Thread Bulat Ziganshin
Hello Simon, Wednesday, June 17, 2009, 11:55:15 AM, you wrote: > Right, so getArgs is already fine. it's what i've found in Jun15 sources: #ifdef __GLASGOW_HASKELL__ getArgs :: IO [String] getArgs = alloca $ \ p_argc -> alloca $ \ p_argv -> do getProgArgv p_argc p_argv p<- fromInt

Re[2]: [Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

2009-06-17 Thread Bulat Ziganshin
Hello Simon, Wednesday, June 17, 2009, 12:01:11 PM, you wrote: > foreign import stdcall unsafe "GetFullPathNameW" >c_GetFullPathName :: LPCTSTR -> DWORD -> LPTSTR -> Ptr LPTSTR -> IO DWORD you are right, i was troubled by unused GetFullPathNameA import in System.Directory: #if defined(ming

Re[2]: [Haskell-cafe] Re: Unicode workaround for getDirectoryContents under Windows?

2009-06-17 Thread Bulat Ziganshin
Hello Simon, Wednesday, June 17, 2009, 12:46:49 PM, you wrote: > I see, so you were previously quoting code from some other source. from my program > Where did the GetCommandLineW version come from? Do you know of any > issues that would prevent us using it in GHC? it should be as fine as an

Re[2]: [Haskell-cafe] curious about sum

2009-06-17 Thread Bulat Ziganshin
Hello Henk-Jan, Wednesday, June 17, 2009, 3:07:41 PM, you wrote: > I have done some research on functions in the base libraries, whether they > can handle large lists long time ago i had problems with filterM, may be it's still fails -- Best regards, Bulatmailto:bu

Re: [Haskell-cafe] Re: Which windowing toolkit to use?

2009-06-17 Thread Bulat Ziganshin
Hello Gu?nther, Thursday, June 18, 2009, 12:46:40 AM, you wrote: > there is one other alternative to gtk2hs and wxhaskell: .NET Forms > It is accessable through Sigbjorn Finne's hs-dotnet package. > I am right now *starting* to use it myself, so just consider it an option. can you please provi

Re[2]: [Haskell-cafe] Re: (fwd) Haskell logo fail

2009-06-18 Thread Bulat Ziganshin
Hello minh, Thursday, June 18, 2009, 11:17:07 AM, you wrote: >>> Why don't we have a picture of a cool dinosaur instead? >> >> Something cool because the last heat of life went out of it >> 65 million years ago? > "made with secret dinosaur technology" "made with dinosaur technology" :))) -

[Haskell-cafe] Re[2]: Unicode workaround for getDirectoryContents under Windows?

2009-06-18 Thread Bulat Ziganshin
Hello Simon, Thursday, June 18, 2009, 1:22:30 PM, you wrote: >> myGetArgs = do > Presumably we'd also have to remove the +RTS ... -RTS in Haskell if we > did this, correct? yes, it's long-standing in my own to-do list :) -- Best regards, Bulatmailto:bulat.zigans.

Re: [Haskell-cafe] [Beginner's Question] How to read filenames from a DirStream

2007-04-09 Thread Bulat Ziganshin
Hello Albert, Monday, April 9, 2007, 6:46:14 AM, you wrote: > It can print the first entry of the dir, but how can we list it all > like the C prog?  map ? list comperhension? http://haskell.org/haskellwiki/IO_inside forever :) -- Best regards, Bulatmailto:[EMAIL

Re[2]: [Haskell-cafe] Why Perl is more learnable than Haskell

2007-04-13 Thread Bulat Ziganshin
Hello kynn, Thursday, April 12, 2007, 7:10:56 AM, you wrote: > rather pragmatic. I have not been able to find enough support in Haskell > for everyday tasks (e.g. read a stream from a socket; parse it into a simple > data structure; process the data in the structure; print out the results to > a

Re: [Haskell-cafe] Re: release plans

2007-04-25 Thread Bulat Ziganshin
Hello Simon, Tuesday, April 17, 2007, 11:51:07 AM, you wrote: > The parallel GC code is currently sitting dormant waiting for me to go back to > it and figure out why it isn't performing very well. Basically I saw little > or > no speedup regardless of how many CPUs I threw at it, which suggest

Re: [Haskell-cafe] Program optimisation

2007-04-25 Thread Bulat Ziganshin
Hello Andrew, Friday, April 20, 2007, 10:01:32 PM, you wrote: > I have *no idea* if this is an appropriate place to put this, but here > goes... http://haskell.org/haskellwiki/Library/AltBinary http://haskell.org/haskellwiki/Modern_array_libraries last article contains information about slownes

Re[2]: [Haskell-cafe] COM and Haskell

2007-04-25 Thread Bulat Ziganshin
Hello Andrew, Tuesday, April 24, 2007, 5:03:53 AM, you wrote: > A core difficulty is the mismatch between the object-oriented type > system of .NET and Haskell's. This is something that RubyCLR didn't > need to conquer, Ruby already having object-oriented concepts. Simon Marlow recently wrote

Re[2]: [Haskell-cafe] faster factorial function via FFI?

2007-04-25 Thread Bulat Ziganshin
Hello Dan, Tuesday, April 24, 2007, 3:25:39 AM, you wrote: > Usings Ints everywhere isn't an option, because my final answers are > definitely Integers -- although I might try using Ints in some places. I may be memoizing is the right answer? factorials :: Array Int Integer factorials = array (

Re[2]: [Haskell-cafe] run-time type testing in haskell?

2007-04-28 Thread Bulat Ziganshin
Hello Eric, Saturday, April 28, 2007, 5:33:02 PM, you wrote: > Type classes allow us to adopt approach (0) in Haskell, but don't seem > to allow approach (1) may be multi-parameter type class is what you need here, may be just closure. anyway, OOP may be simulated in Haskell via hierarchy of

Re[2]: [Haskell-cafe] Hugs/nhc getting progressively slower

2007-05-02 Thread Bulat Ziganshin
Hello Neil, Wednesday, May 2, 2007, 2:48:16 PM, you wrote: > the "right answer" always, then I think its a much nicer choice. For > the particular case of ByteString, type ByteString=String means you > roughly import Data.List - not that much additional work or > maintenance. then Binary library

Re: [Haskell-cafe] The Trivial Monad

2007-05-04 Thread Bulat Ziganshin
Hello Adrian, Friday, May 4, 2007, 11:43:35 AM, you wrote: > don't understand what this monad thingy is all about. the whole monadic business was introduced with the sole goal to let haskellers believe that they are smarter than other programmers :) -- Best regards, Bulat

Re: [Haskell-cafe] Intermediate Haskell Books?

2007-05-07 Thread Bulat Ziganshin
Hello Adrian, Sunday, May 6, 2007, 12:24:27 PM, you wrote: > Are there any good books about intermediate to advanced Haskell? The perhaps, "Purely Functional Data Structures" by Okasaki? also, "Applications of Functional Programming" may be interesting -- Best regards, Bulat

Re[2]: [Haskell-cafe] The Trivial Monad

2007-05-08 Thread Bulat Ziganshin
Hello Ketil, >> the whole monadic business was introduced with the sole goal to let >> haskellers believe that they are smarter than other programmers :) > Or perhaps to ensure that they are? you mean Darwin's idea of natural selection? :) -- Best regards, Bulatmai

Re[2]: [Haskell-cafe] global variables

2007-05-20 Thread Bulat Ziganshin
Hello Isaac, Sunday, May 20, 2007, 6:41:54 PM, you wrote: > Maybe some sort of ISOLATE, DON'T_OPTIMIZE (but CAF), or > USED_AS_GLOBAL_VARIABLE pragma instead of just the insufficient NOINLINE > would be a good first step... or LOOK_BUT_DON'T_TOUCH :) -- Best regards, Bulat

Re: [Haskell-cafe] FFI and multi-threading

2007-05-27 Thread Bulat Ziganshin
Hello Mauri­cio, Saturday, May 26, 2007, 10:58:55 PM, you wrote: > Do you guys know of a good example of Haskell > calling functions to a thread-safe library i doesn't understand exactly your question, but i have a large program that use thread-safe calls: http://www.haskell.org/bz/FreeArc-s

Re: [Haskell-cafe] Broadcast signals between threads

2007-05-27 Thread Bulat Ziganshin
Hello Joachim, Friday, May 25, 2007, 9:57:45 PM, you wrote: > I’m writing a TCP server app ATM. It has one thread per client. Some of > the clients want to be notified if the internal state changes, while > others are happily chatting with the server, possible modifying the > internal state. What

Re[2]: [Haskell-cafe] New book: Real-World Haskell!

2007-05-27 Thread Bulat Ziganshin
Hello Doug, Friday, May 25, 2007, 9:30:15 PM, you wrote: > Last time I read O'Reilly's policy, it stated that you're free to > suggest an animal, but that they have a full-time person that makes > the decision on which animal is on the book. full-time person! i want to have such hard job :)))

Re[2]: [Haskell-cafe] Network.HTTP+ByteStrings Interface--Or: How to shepherd handles and go with the flow at the same time?

2007-05-27 Thread Bulat Ziganshin
Hello Jules, Friday, May 25, 2007, 1:17:49 AM, you wrote: > The key point under discussion was what kind of interface the HTTP > library should expose: synchronous, asynchronous? Lazy, strict? isn't it possible to implement simplest (strict sync) interface as base and then add higher levels if t

Re[2]: [Haskell-cafe] Slower with ByteStrings?

2007-05-27 Thread Bulat Ziganshin
Hello Bryan, Sunday, May 27, 2007, 3:30:50 AM, you wrote: >> I think, given my simple algorithm that means that (==) for >> ByteStrings is slower than (==) for String. Is this possible? > Yes indeed. Over ByteStrings, (==) is implemented as a call to memcmp. > For small strings, this loses by

Re: [Haskell-cafe] Language extensions [was: Memoization]

2007-05-27 Thread Bulat Ziganshin
Hello Andrew, Sunday, May 27, 2007, 5:19:51 PM, you wrote: > Seriously. Haskell seems to attract weird and wonderful type system > extensions like a 4 Tesla magnet attracts iron nails... And most of > these extensions seem to serve no useful purpose, as far as I can > determine. existentials i

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

2007-05-28 Thread Bulat Ziganshin
Hello Andrew, Monday, May 28, 2007, 2:43:47 PM, you wrote: > - Chapter 12 is incomprehensible (to me at least). "Fun with Phantom > Types" I've read it several times, and I still couldn't tell you what a > phantom type is... and noone else know! that is the whole fun is! :) seriously, i'm known

[Haskell-cafe] Re: [Haskell] ST vs State

2007-05-30 Thread Bulat Ziganshin
Hello Federico, Wednesday, May 30, 2007, 12:54:35 PM, you wrote: > Control.Monad.ST > And > Control.Monad.State ST monad is just reduced IO monad which like IO organizes sequential (imperative) ordr of execution but unlike IO supports only a small closed set of operations - those working with ST

Re: [Haskell-cafe] Just for a laugh...

2007-06-01 Thread Bulat Ziganshin
Hello Andrew, Thursday, May 31, 2007, 11:47:28 PM, you wrote: > (Otherwise... wasn't there some library somewhere for serialising values > in binary?) Binary, AltBinary (see latest HCAR), just an example using AltBinary: main = do let s = encode (1.1::Float) -- s has type String

Re[2]: [Haskell-cafe] Just for a laugh...

2007-06-01 Thread Bulat Ziganshin
Hello Jules, Friday, June 1, 2007, 3:02:33 PM, you wrote: > machine-independent? Whereas this (stupid) question explicitly asked for > *your particular hardware's* floating point rep. there is castSTUArray function which is widely used exactly for this purpose. look for examples of its usage in h

Re: [Haskell-cafe] Re: Hardware

2007-06-02 Thread Bulat Ziganshin
Hello Jon, Friday, June 1, 2007, 11:17:07 PM, you wrote: > (we had the possiblity of funding to make something). We > had lots of ideas, but after much arguing back and forth the > conclusion we reached was that anything we could do would > either be slower than mainstream hardware or would be

Re[2]: [Haskell-cafe] I just don't get it (data structures and OO)

2007-06-03 Thread Bulat Ziganshin
Hello Phlex, Sunday, June 3, 2007, 11:41:29 AM, you wrote: > That's precisely the thing i don't understand. > In order to update node 3 with a new pointer, i need to mutate it, so i > need to recreate it, and so on up to node 1. yes, that's true > Now in this exemple, it's ok since that's a regu

Re[2]: [Haskell-cafe] I just don't get it (data structures and OO)

2007-06-03 Thread Bulat Ziganshin
Hello Phlex, Sunday, June 3, 2007, 12:34:26 PM, you wrote: > So i need to do something like this : > changePlanetAge universe galaxy planet age = ...lots of code, returning > a new universe > And the same code for all functions updating any of the properties of my > planet ... > And the same code

Re[2]: [Haskell-cafe] I just don't get it (data structures and OO)

2007-06-03 Thread Bulat Ziganshin
Hello Malcolm, Sunday, June 3, 2007, 1:13:06 PM, you wrote: >> The thing is, now that i have my planet p... i want to change it's age >> ... and get back the new state of the universe... > There has been lots of research into easing the pain of creating this > outer traversal code - search for "S

Re[2]: [Haskell-cafe] Optimising UTF8-CString -> String marshaling, plus comments on withCStringLen/peekCStringLen

2007-06-04 Thread Bulat Ziganshin
Hello Duncan, Monday, June 4, 2007, 2:25:10 PM, you wrote: >> - the chr function tests that its Int argument is less than 1114111, >>before constructing the Char. It'd be nice to avoid this test. use unsafeChr or, for portability, smth like this: #ifdef GHC import GHC.Exts (unsafeChr) #els

Re[2]: [Haskell-cafe] Re: Keys and Maps [Was: Re: I just don't get it (data structures and OO)]

2007-06-08 Thread Bulat Ziganshin
> I second that. I particularly like the elimination of ]'s. We certainly > need some symbol to separate the map and the key; but we do really need > to also mark "here be the end of the key"? and how (arr ! "key" ++ "data") should be parsed? :) -- Best regards, Bulat

Re: [Haskell-cafe] Fast number parsing with strict bytestrings [Was: Re: Seemingly subtle change causes large performance variation]

2007-06-08 Thread Bulat Ziganshin
Hello Donald, Friday, June 8, 2007, 5:42:41 AM, you wrote: > Previous experience[1] indicates it is pretty hard to write a C line > parsing program[2] that that run this fast. And the code, with comments: [2] uses gets() function while your haskell code read whole buffer each time. that is the

[Haskell-cafe] Re: [Haskell] Who pays for *.haskell.org machines?

2007-06-13 Thread Bulat Ziganshin
Hello Malcolm, Wednesday, June 13, 2007, 1:55:43 PM, you wrote: > In addition, we are in the process of setting up a separate server called > code.haskell.org thank you, it's all are great news. some questions: when you plan to make code.haskell.org available? is its funding will be reliabl

Re: [Haskell-cafe] Reading open data types

2007-06-13 Thread Bulat Ziganshin
Hello Benja, Wednesday, June 13, 2007, 6:12:25 PM, you wrote: > We've had a discussion on #haskell about how we can make a function > that reads in serialized values of an open data type, such as look at Data.Generics.Text which may be implements exactly what you need -- Best regards, Bulat

Re: [Haskell-cafe] Haskell record extension?

2007-06-16 Thread Bulat Ziganshin
Hello bf3, Saturday, June 16, 2007, 1:24:58 AM, you wrote: > I read multiple papers with proposals to fix this, but does GHC implement > any of these? no, but hugs implements one of these proposals: see "7.2 Extensible records: Trex" in http://cvs.haskell.org/Hugs/pages/hugsman/exts.html (hug

Re[2]: [Haskell-cafe] Haskell record extension?

2007-06-16 Thread Bulat Ziganshin
Hello bf3, Saturday, June 16, 2007, 3:24:06 PM, you wrote: > However, I never understood why Haskell doesn't permit the same name for a > function acting on different types, even without using type classes. Must be > some deeper reason for it (currying?) i guess because it makes type inference pr

Re[2]: [Haskell-cafe] IDE?

2007-06-16 Thread Bulat Ziganshin
Hello bf3, Saturday, June 16, 2007, 3:23:40 PM, you wrote: > The point I wanted to make is, that I can't find an > easy-to-install-ready-to-use-and-rock-n-roll IDE for Windows that comes with > all or most of those features. I mean something like Borland TurboPascal it's well-known trap. haskell

Re[4]: [Haskell-cafe] IDE?

2007-06-16 Thread Bulat Ziganshin
Hello Peter, Sunday, June 17, 2007, 12:34:43 AM, you wrote: > nowadays have with Visual Studio 2005 and Resharper for doing > compilation, code-documentation-tips, code-completion, refactoring, > navigation, debugging, boiler plate code generation, is amazing. with emacs/vim you will get compila

Re[2]: [Haskell-cafe] Useful IDE features - "implement instance"

2007-06-18 Thread Bulat Ziganshin
Hello peterv, Monday, June 18, 2007, 6:44:06 PM, you wrote: > Just another wild idea which I might find useful, but is more like > refactoring, is to convert the fields of a record to get/set type-classes, > and refactor all usages of those fields. i never done such refactoring. just use differen

Re[2]: [Haskell-cafe] yi or not to yi was: IDE?

2007-06-18 Thread Bulat Ziganshin
Hello Andrew, Monday, June 18, 2007, 9:31:46 PM, you wrote: > OTOH... how the heck do you write an operating system in a language that > doesn't even support I/O? :-S it does lazily creates new world on each IO operation. advantages: if some file will be never used in future, it will not be writ

Re[2]: [Haskell-cafe] String Hashing

2007-06-19 Thread Bulat Ziganshin
Hello Jan-Willem, Tuesday, June 19, 2007, 1:17:25 AM, you wrote: > table is the right structure to begin with? I fell back on much- > simpler multiplicative hashing schemes for Data.HashTable. A btw, are you seen http://isthe.com/chongo/tech/comp/fnv/ ? he suggest to use non-zero value as st

Re: [Haskell-cafe] Reading/writing packed bytes from file

2007-06-20 Thread Bulat Ziganshin
Hello Jefferson, Wednesday, June 20, 2007, 12:20:28 AM, you wrote: > 4-byte int (count), > (count) 2-byte unsigned shorts, > (count) 4-byte floats using my Streams package ( http://haskell.org/haskellwiki/Library/AltBinary ): import Data.AltBinary readall recordcount h = do replicateM recordc

Re: [Haskell-cafe] Reification in Haskell, was: To yi or not to yi

2007-06-20 Thread Bulat Ziganshin
Hello Pasqualino, Wednesday, June 20, 2007, 11:30:32 AM, you wrote: >> > Most languages, even Java, have a reflection capability to dynamically >> > inspect an object. It is surprising that Haskell doesn't offer it. how about asm? :) there are no OOP objects in Haskell, each name is just an add

Re: [Haskell-cafe] haskell crypto is reaaaaaaaaaally slow

2007-06-20 Thread Bulat Ziganshin
Hello Anatoly, if you still believe in haskell/ghc speed i suggest you to read the following: http://www.cse.unsw.edu.au/~chak/papers/afp-arrays.ps.gz http://www.cse.unsw.edu.au/~dons/papers/fusion.pdf -- Best regards, Bulatmailto:[EMAIL PROTECTED]

Re[2]: [Haskell-cafe] Collections

2007-06-20 Thread Bulat Ziganshin
Hello Chaddai, Wednesday, June 20, 2007, 3:14:54 PM, you wrote: > Well lists are really useful, but I don't think all Haskell > programmers are like you, in fact I think only the enthusiast newbies > (like.. you maybe ?) only use lists without asking themselves if there > is not a data structure

Re: [Haskell-cafe] Using Template Haskell to automate QuickCheck testing?

2007-06-20 Thread Bulat Ziganshin
Hello Brent, Thursday, June 21, 2007, 5:38:02 AM, you wrote: > However, after reading all about TH it doesn't seem like there's a way > to do this (reflecting on the current module to pull out the names of > certain top-level declarations).   i don't know whether it's implemented, but standard

Re[2]: [Haskell-cafe] haskell crypto is reaaaaaaaaaally slow

2007-06-20 Thread Bulat Ziganshin
Hello Anatoly, Thursday, June 21, 2007, 3:11:13 AM, you wrote: > implementation. You should be able to stay within an order of > magnitude from C with haskell without resorting to weird compiler > tricks. why you believe in it? are you ever implemented anything in Haskell without tricks and it

Re[2]: [Haskell-cafe] haskell crypto is reaaaaaaaaaally slow

2007-06-20 Thread Bulat Ziganshin
Hello David, Thursday, June 21, 2007, 3:49:55 AM, you wrote: >> A list of Word8 is -extremely- inefficient. > To expand on that terse (but very true) statement, a list of Word8 > increases the space usage by a factor of probably around an order of > magnitude (two pointers + 1 byte vs 1 byte), c

Re[2]: [Haskell-cafe] haskell crypto is reaaaaaaaaaally slow

2007-06-20 Thread Bulat Ziganshin
Hello Duncan, Thursday, June 21, 2007, 7:36:13 AM, you wrote: > The smallest possible would be 2 words overhead by just using a > ByteArray#, i tried it once and found that ByteArray# size is returned rounded to 4 - there is no way in GHC runtime to alloc, say, exactly 37 bytes. and don't forget

Re[2]: [Haskell-cafe] Reification in Haskell, was: To yi or not to yi

2007-06-21 Thread Bulat Ziganshin
titto > On Wednesday 20 June 2007 16:33:12 Bulat Ziganshin wrote: >> Hello Pasqualino, >> >> Wednesday, June 20, 2007, 11:30:32 AM, you wrote: >> >> > Most languages, even Java, have a reflection capability to dynamically >> >> > inspect an objec

RTTI in Haskell Re[2]: [Haskell-cafe] To yi or not to yi, is this really the question? A plea for a cooperative, ubiquitous, distributed integrated development system.

2007-06-21 Thread Bulat Ziganshin
Hello Tomasz, Thursday, June 21, 2007, 12:27:58 PM, you wrote: > I also find it hard to believe that most languages have reflection, > especially those which are traditionally focused on efficiency and > compilation to native code, like C, C++, Fortran, Pascal, etc. for OOP languages, it is no p

Re[2]: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-21 Thread Bulat Ziganshin
Hello Philip, Thursday, June 21, 2007, 3:36:27 PM, you wrote: > revision used Float and it was slower than the current one. Making the > datatypes strict also makes no difference. don't forget to use either -funpack-strict-fields or {#- UNPACK -#} pragma -- Best regards, Bulat

Re: [Haskell-cafe] Haskell serialisation, was: To yi or not to yi...

2007-06-21 Thread Bulat Ziganshin
Hello Pasqualino, Thursday, June 21, 2007, 3:55:35 PM, you wrote: > I wonder: would it be possible to use the compile time reflection facilities > of TH to write a 'serialise' function, keeping the TH AST so that it can be > used at run-time? yes. but you will need to find any functions used in

Type classes vs C++ overloading Re: [Haskell-cafe] Messing around with types [newbie]

2007-06-21 Thread Bulat Ziganshin
Hello Cristiano, Thursday, June 21, 2007, 4:46:27 PM, you wrote: > class FooOp a b where >   foo :: a -> b -> IO () > > instance FooOp Int Double where >   foo x y = putStrLn $ (show x) ++ " Double " ++ (show y) this is rather typical question :) unlike C++ which resolves any overloading at C

Re: Poor man Haskell serialisation using TH, was: Re: [Haskell-cafe] Haskell serialisation

2007-06-21 Thread Bulat Ziganshin
Hello Pasqualino, Thursday, June 21, 2007, 7:35:47 PM, you wrote: > So, the state is both applicable and serialisable (on the receiving side we > should naturally have an interpreter for the TH representation). and this interpreter should have a way to find function definition by its name - it's

Re[2]: Type classes vs C++ overloading Re: [Haskell-cafe] Messing around with types [newbie]

2007-06-21 Thread Bulat Ziganshin
Hello Dan, Thursday, June 21, 2007, 7:39:35 PM, you wrote: >>> class FooOp a b where >>> foo :: a -> b -> IO () >>> >>> instance FooOp Int Double where >>> foo x y = putStrLn $ (show x) ++ " Double " ++ (show y) >> >> this is rather typical question :) unlike C++ which resolves any >> ove

Re[2]: Poor man Haskell serialisation using TH, was: Re: [Haskell-cafe] Haskell serialisation

2007-06-21 Thread Bulat Ziganshin
> equivalent (as produced by TH's pprint) using GHC API or hs-plugins. > Probably not very efficient but quite easy to implement, > Best, > titto > On Thursday 21 June 2007 16:39:58 Bulat Ziganshin wrote: >> Hello Pasqualino, >> >> Thursday, June 21, 2

Re[2]: Poor man Haskell serialisation using TH, was: Re: [Haskell-cafe] Haskell serialisation

2007-06-21 Thread Bulat Ziganshin
Hello Pasqualino, Thursday, June 21, 2007, 8:43:20 PM, you wrote: >> how it can interpret call to "foo" without loading it? :) > What am I missing? i mean that there are no "either .. or .." alternatives as you said - we can't interpret AST without function bindings -- Best regards, Bulat

Re: [Haskell-cafe] Filesystem access

2007-06-21 Thread Bulat Ziganshin
Hello Andrew, Friday, June 22, 2007, 12:19:51 AM, you wrote: > 1. Is there *any* way to determine how large a file is *without* opening > it? The only library function I can find to do with file sizes is > hFileSize; obviously this only works for files that you have permission > to open! std lib

Re[4]: [Haskell-cafe] haskell crypto is reaaaaaaaaaally slow

2007-06-21 Thread Bulat Ziganshin
Hello Duncan, Thursday, June 21, 2007, 8:48:53 AM, you wrote: >> > The smallest possible would be 2 words overhead by just using a >> > ByteArray#, >> >> i tried it once and found that ByteArray# size is returned rounded to 4 - >> there is no way in GHC runtime to alloc, say, exactly 37 bytes. a

Re[2]: [Haskell-cafe] Haskell version of ray tracer code is much slower than the original ML

2007-06-22 Thread Bulat Ziganshin
Hello Philip, Friday, June 22, 2007, 7:36:51 PM, you wrote: > Langauge File Time in seconds > Haskell ray.hs 38.2 > OCamlray.ml 23.8 > g++-4.1 ray.cpp 12.6 can you share sourcecode of this variant? i'm interested to see how much it is obfuscated btw, *their* measurement said that

Re: [Haskell-cafe] A probably-stupid question about a Prelude implementation.

2007-06-22 Thread Bulat Ziganshin
Hello Michael, Friday, June 22, 2007, 7:31:17 PM, you wrote: no surprise - you got a lot of answers :) it is the best part of Haskell, after all :) the secret Haskell weapon is lazy evaluation which makes *everything* short-circuited. just consider standard (&&) definition: (&&) False _ = Fals

Re[2]: [Haskell-cafe] "Graphical Haskell"

2007-06-23 Thread Bulat Ziganshin
Hello Donald, Saturday, June 23, 2007, 8:46:06 AM, you wrote: >> - Regarding performance (for real-time simulations, not GUIs), I think the >> garbage collector will get really stressed using FRP because of all those >> infinite lazy streams; my gut feeling says a generational garbage collector

Re[2]: [Haskell-cafe] Need for speed: the Burrows-Wheeler Transform

2007-06-23 Thread Bulat Ziganshin
Hello Andrew, Saturday, June 23, 2007, 11:21:26 AM, you wrote: > ...OK...so how do I make Haskell go faster still? > Presumably by transforming the code into an ugly mess that nobody can > read any more...? bwt transformation is very good researched area, so probably you will not get decent per

Re[2]: [Haskell-cafe] Need for speed: the Burrows-Wheeler Transform

2007-06-23 Thread Bulat Ziganshin
Hello Andrew, Saturday, June 23, 2007, 2:45:01 PM, you wrote: > Hey, I'm just glad I managed to get within striking distance of Mr C++. > So much for Haskell being "inherently less performant". :-P my little analysis says that it's probably due to different sort() implementations, so this says n

Re[2]: [Haskell-cafe] Parallel + exceptions

2007-06-23 Thread Bulat Ziganshin
Hello Andrew, Saturday, June 23, 2007, 7:12:52 PM, you wrote: > Is everything described in that paper actually implemented now? (And > implemented in exactly the same way as the paper says?) difference may be in subtle details. it just works for me :) >> in my experience, exceptions are rarely

Re: [Haskell-cafe] Parallel + exceptions

2007-06-23 Thread Bulat Ziganshin
Hello Andrew, Saturday, June 23, 2007, 5:59:45 PM, you wrote: > The two things mentioned in the subject line are both things I've never > tried with Haskell. I've seen a lot of papers about these things, but I > don't really understand what the current state of play with this is. Are > any of the

Re[2]: [Haskell-cafe] Need for speed: the Burrows-Wheeler Transform

2007-06-23 Thread Bulat Ziganshin
Hello Andrew, Saturday, June 23, 2007, 4:02:54 PM, you wrote: > The point being that lots of people look at Haskell and go "oh, that's > very cute for writing trivial example code, but it can never be fast; > for that you must use C or C++". and that's true :) as i said, your C++ code is very f

Re[2]: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Bulat Ziganshin
Hello Michael, Monday, June 25, 2007, 2:10:28 PM, you wrote: > Does this make more sense now? And can it be done somehow in Haskell? runCheckedCode = checkBeforeRun [actionA x y, actionB z t, actionC] actionA x y b | b = -- check conditions | otherwise = -- perform action

Re[2]: [Haskell-cafe] directory tree?

2007-06-25 Thread Bulat Ziganshin
Hello Chad, Monday, June 25, 2007, 10:47:11 PM, you wrote: > bar = fmap decompress $ B.readFile "myData.gz" try it with non-lazy bytestrings: import qualified Data.ByteString as B -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___

Re: [Haskell-cafe] Re: Propositional logic question

2007-06-26 Thread Bulat Ziganshin
Hello apfelmus, Tuesday, June 26, 2007, 12:45:54 PM, you wrote: > That works for classical logic where ¬A \/ A always holds, but the task > here is to prove it for intuitionistic logic. is it the same as so-called "woman logic"? :) -- Best regards, Bulatmailto:[EM

Re[2]: [Haskell-cafe] Preferred way to get data from a socket

2007-06-27 Thread Bulat Ziganshin
Hello Donald, Wednesday, June 27, 2007, 6:37:07 AM, you wrote: >> I also know Bulat Ziganshin had put together a nice-looking Streams >> library (http://unix.freshmeat.net/projects/streams/) based on John >> Goerzen's previous HVIO work, but I wasn't sure if the Byt

Re[2]: [Haskell-cafe] Preferred way to get data from a socket

2007-06-27 Thread Bulat Ziganshin
Hello Donald, Wednesday, June 27, 2007, 11:40:28 AM, you wrote: >> using my library should allow 30-50 mb/s i/o speed but its >> installation may be tricky since it was not updated over a year > That's interesting, Bulat. Two points I'd like to ask about the streams > library: > What machine d

Re[3]: [Haskell-cafe] Preferred way to get data from a socket

2007-06-27 Thread Bulat Ziganshin
Hello Bulat, Wednesday, June 27, 2007, 3:34:02 PM, you wrote: >> What machine did you do the IO benchmarks on? Since we get well over 10x >> that speed word writing in Data.Binary now, for example, on a fast >> machine. (Duncan, what's the max throughput we've seen?) > test box was Duron 1.2 GHz

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

2007-06-28 Thread Bulat Ziganshin
Hello Andrew, Thursday, June 28, 2007, 1:28:05 AM, you wrote: > Wow, wait a sec - case expressions are allowed to have guards too?? btw, it's used to implement boolean switches: case () of _ | a>0 -> 1 | a<0 -> -1 | otherwise -> 0 -- Best regards, Bulat

Re: [Haskell-cafe] advice: instantiating/duplicating modules

2007-06-29 Thread Bulat Ziganshin
Hello Nicolas, Friday, June 29, 2007, 9:07:38 PM, you wrote: > I'm rather unfamiliar with Template Haskell, but it sounds like it > might fit the bill. Although, if I recall correctly, instances and > type declarations splicing are yet to be implemented in GHC? instances - definitely not. i've u

Re: [Haskell-cafe] Abstraction leak

2007-06-30 Thread Bulat Ziganshin
Hello Andrew, Friday, June 29, 2007, 10:39:28 PM, you wrote: > I'm writing a whole bunch of data compression programs. me too :) but i never used Haskell for compression itself, only for managing archives. fast compression routines are written in C++ http://www.haskell.org/bz -- Best regards

Re: [Haskell-cafe] Name Decoration and Undefined References

2007-06-30 Thread Bulat Ziganshin
Hello SevenThunders, Saturday, June 30, 2007, 7:45:57 AM, you wrote: > My own code is half Haskell and half C. My build process is rather complex i have the same. initially C code was compiled by gcc but finally i switched to ghc-only compilation. it's also important to use the same gcc for com

Re[2]: [Haskell-cafe] Abstraction leak

2007-07-01 Thread Bulat Ziganshin
Hello Andrew, Saturday, June 30, 2007, 11:48:19 AM, you wrote: >> me too :) but i never used Haskell for compression itself, only for >> managing archives. fast compression routines are written in C++ >> > What, you're telling me that "fast" software cannot be written in > Haskell? :-P in

Re: [Haskell-cafe] sha1 implementation thats "only" 12 times slower then C

2007-07-01 Thread Bulat Ziganshin
Hello Anatoly, Sunday, July 1, 2007, 3:58:24 AM, you wrote: > Anyone have any pointers on how to get hashElem and updateElem to run > faster, or any insight on what exactly they are allocating. To me it > seems that those functions should be able to do everything they need > to without a malloc.

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