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

2007-06-19 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 different

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

2007-06-19 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

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

2007-06-19 Thread peterv
Hi Bulat, Yes, that's what I had to do when using assembler in the 19080s, but it was nice to get rid of that when using C/C++ or any other imperative/OO language that I'm aware of. You see, for someone with an imperative/OO background, the Haskell record restriction on field names looks

RE: [Haskell-cafe] Haskell mode for emacs - some questions

2007-06-19 Thread peterv
Thanks for the info. Yes, but I can only use GHCI for error checking, because I'm using GTK2HS/SOE which does not work well with GHCI under Windows, it only runs when using GHC. And when I will me using HopenGL, I will want performance, as I will be doing experiments with particle systems, 3D

Re: [Haskell-cafe] embedded build language?

2007-06-19 Thread Tomasz Zielonka
[I hope you don't mind that I send this letter to haskell-cafe too. I thought someone else might be interested.] On Mon, Jun 18, 2007 at 10:52:40AM -0700, Greg Fitzgerald wrote: first let's see if anybody likes the general idea Would you mind describing the role of Depends.hs in your

Re: [Haskell-cafe] Haskell mode for emacs - some questions

2007-06-19 Thread Jules Bean
peterv wrote: And when I will me using HopenGL, I will want performance, as I will be doing experiments with particle systems, 3D rendering, etc. Basically the stuff I did for many years but now using Haskell :) Having to do anything more than hitting a key to compile and run an application

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

[Haskell-cafe] Re: String Hashing

2007-06-19 Thread apfelmus
Thomas Conway wrote: On 6/19/07, apfelmus [EMAIL PROTECTED] wrote: Trie it is, not balanced tree. A logarithm in this would be new to me. :) True enough, my braino. So, accessing a key in a trie is O(key size in bits), not much different from a hash table. As a side node, Mr. Exp

Re: [Haskell-cafe] Re: String Hashing

2007-06-19 Thread Thomas Conway
On 6/19/07, apfelmus [EMAIL PROTECTED] wrote: [nice exposition of how you could do lazy look-ma-no-updates tries] Clearly, I still think too much like a logic programmer. :-) T. -- Dr Thomas Conway [EMAIL PROTECTED] Silence is the perfectest herald of joy: I were but little happy, if I

Re: [Haskell-cafe] Building Yi (and wider Cabal stuff)

2007-06-19 Thread Thomas Schilling
On 18 jun 2007, at 18.31, Jaap Weel wrote: If you want to install into a nonstandard directory, do runhaskell Setup.hs configure --prefix /bla/di/bla Are you sure this works? I think it is important that there be no whitespace between flag and parameter: runhaskell Setup.hs

Re: [Haskell-cafe] OS design FP aesthetics

2007-06-19 Thread Tony Finch
On Mon, 18 Jun 2007, Creighton Hogg wrote: Okay, but these don't seem to really be design flaws so much as the inevitable results of age and the need for backwards compatibility. I'm looking more for technical problems that you would want to see fixed in our magical UberOS. I don't think

[Haskell-cafe] latex table and backgound color

2007-06-19 Thread Adrian Dusa
Hello all, I'm a newb on this list, hoping to get (what I suppose is) a straightforward answer to a problem. Is there any possibility to set a background color for different rows in a tabular environment? What I hope to get is  easily done in OpenOffice for example:

Re: [Haskell-cafe] latex table and backgound color

2007-06-19 Thread Neil Mitchell
Hi Adrian, You are probably better asking on a latex mailing list - this one is mainly for questions about the Haskell programming language. If you are on IRC the #latex channel on irc.freenode.net is very good - that's where I go with my latex questions! Thanks Neil On 6/19/07, Adrian Dusa

Re: [Haskell-cafe] latex table and backgound color

2007-06-19 Thread Jens Fisseler
Is there any possibility to set a background color for different rows in a tabular environment? You might try the colortbl package: http://texcatalogue.sarovar.org/entries/colortbl.html But keep in mind that this is the Haskell-Cafe list, which has nothing to do with LaTeX. Regards,

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

2007-06-19 Thread Claus Reinke
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. you could use a preprocessor (DrIFT, Data.Derive) to derive the instances, but you need to share the class

Re: [Haskell-cafe] hSetBuffering woes

2007-06-19 Thread Eric
Bryan O'Sullivan wrote: Eric wrote: I'm writing a simple HTTP server and am trying to implement the POST method. That's a rather general problem statement, indeed :-) For an application like this, I'd suggest that explicit resource management is the way to go, and that you should not be

[Haskell-cafe] FFI and Excel VBA

2007-06-19 Thread Lewis-Sandy, Darrell
I am new to using the Haskell FFI, and have been trying to implement the example in section 11.6 of the GHC user's guide. I have finally gotten to the point where my dll compiles (there is a missing space in the mainDll.h code at line 4:12) using GHC 6.6.1, and used the declare statement to

Re: [Haskell-cafe] OS design FP aesthetics

2007-06-19 Thread Andrew Coppin
Creighton Hogg wrote: (Also, have you noticed that no large Haskell applications exist? It's very hard to convince people that Haskell is not a toy language when no large applications exist. Building an entire *OS* with it would rather satisfy that requirement...!) Well, I

Re: [Haskell-cafe] Useful IDE features -

2007-06-19 Thread Peter Verswyvelen
That looks nice, just unfortunate you need to cast to ::Float in homer2?Age::Float. I don't see why this is needed, but I must say I don't understand your code completely yet, working on that :) Also, wouldn't this approach be less performant? Or is GHC that good that ist compiles away all

[Haskell-cafe] Collections

2007-06-19 Thread Andrew Coppin
When I was at university, we learned a programming language known as Smalltalk. I was rather good at it. [Ironically, making small talk is one of the things I do worst IRL! But anyway, back to the topic...] In Smalltalk, there is a wide selection of collection types, all with different

Re: [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-19 Thread Thomas Schilling
On 18 jun 2007, at 16.01, Pasqualino 'Titto' Assini wrote: Having just presented a case for the possible rationality of the irrational decision of creating an Emacs-like IDE in Haskell, I wonder if we should not be even more irrational and contemplate the possibility of using Haskell to

[Haskell-cafe] Perl-style numeric type

2007-06-19 Thread Brent Yorgey
Hi all, I've started developing a library to support a Perl-style numeric type that does the right thing without having to worry too much about types. Explicit static typing of numeric types is really great most of the time, and certainly a good idea for larger projects, but probably everyone's

Re: [Haskell-cafe] Collections

2007-06-19 Thread Tomasz Zielonka
On Tue, Jun 19, 2007 at 07:26:20PM +0100, Andrew Coppin wrote: However, Haskell only has 1 type of collection: linked lists. (And only single-linked at that.) While other normal programming languages spend huge amounts of effort trying to select exactly the right collection type for the

Re: [Haskell-cafe] Collections

2007-06-19 Thread Jon Harrop
I'm not a Haskell guru but I think I can answer this... On Tuesday 19 June 2007 19:26:20 Andrew Coppin wrote: In Smalltalk, there is a wide selection of collection types, all with different facilities and efficiency trade offs. There is bag, set, list, array, ordered list, dictionary, hash

Re: [Haskell-cafe] Collections

2007-06-19 Thread Spencer Janssen
On Tue, 19 Jun 2007 19:26:20 +0100 Andrew Coppin [EMAIL PROTECTED] wrote: When I was at university, we learned a programming language known as Smalltalk. I was rather good at it. [Ironically, making small talk is one of the things I do worst IRL! But anyway, back to the topic...] In

Re: [Haskell-cafe] Collections

2007-06-19 Thread Adam Turoff
On 6/19/07, Andrew Coppin [EMAIL PROTECTED] wrote: However, Haskell only has 1 type of collection: linked lists. (And only single-linked at that.) While other normal programming languages spend huge amounts of effort trying to select exactly the right collection type for the task in hand,

Re: [Haskell-cafe] Collections

2007-06-19 Thread Nicolas Frisby
I don't know where you got the notion that such structures are not available in Haskell. There are many efficient data structures in the libraries. Lists are not magical, just popular, natural, and traditional. Specialized data structures are always important. Take a look at the Data.* modules

Re: [Haskell-cafe] Collections

2007-06-19 Thread David House
Andrew Coppin writes: However, Haskell only has 1 type of collection: linked lists. (And only single-linked at that.) Woah there, what about: Data.Map -- lookup tables Data.Array -- lookup tables with enumerated keys. Mutable interfaces are also available. Data.Sequence -- two-ended

Re: [Haskell-cafe] Perl-style numeric type

2007-06-19 Thread Dougal Stanton
On 19/06/07, Brent Yorgey [EMAIL PROTECTED] wrote: PS Also, did anyone get my e-mail to this list of June 8 about Template Haskell and QuickCheck? If you did and it's just that no one knows the answer to my questions, no problem. But I was subscribed in a strange way (through the fa.haskell

Re: [Haskell-cafe] Collections

2007-06-19 Thread Jens Fisseler
On Tue, 19 Jun 2007, Andrew Coppin wrote: In Smalltalk, there is a wide selection of collection types, all with different facilities and efficiency trade offs. There is bag, set, list, array, ordered list, dictionary, hash table, weak array, etc. A whole menagerie of collection types.

Re: [Haskell-cafe] Collections

2007-06-19 Thread Andrew Coppin
Adam Turoff wrote: - Data.Map (more commonly known as 'dictionaries') Ah yes, I've heard about this one. - Data.HashTable (same idea, different runtime characteristics) Well, you learn something every day... (And that, of course, is the reason for asking questions in the first place!)

Re: [Haskell-cafe] Collections

2007-06-19 Thread Andrew Coppin
Nicolas Frisby wrote: I don't know where you got the notion that such structures are not available in Haskell. There are many efficient data structures in the libraries. Lists are not magical, just popular, natural, and traditional. Specialized data structures are always important. Mmm, OK.

[Haskell-cafe] Re: Haskell mode for emacs - some questions

2007-06-19 Thread Stefan Monnier
I finally got emacs using Haskell-mode working. It seems that the latest Sounds like it was difficult. Could you describe what you tried, what didn't work, and what did work in the end? Hopefully I can then improve the doc. - How can I just compile and run in one go without having to type

Re: [Haskell-cafe] Collections

2007-06-19 Thread Alex Queiroz
Hallo, On 6/19/07, Andrew Coppin [EMAIL PROTECTED] wrote: However, Haskell only has 1 type of collection: linked lists. (And only single-linked at that.) While other normal programming languages spend huge amounts of effort trying to select exactly the right collection type for the task in

Re: [Haskell-cafe] Collections

2007-06-19 Thread Albert Y. C. Lai
Take a look at http://www.haskell.org/ghc/docs/latest/html/libraries/index.html There are more elsewhere. I am actually amazed that we have a comprehensive, widely-distributed package for graphs and graph algorithms. I can't say the same about other programming communities (they tend to

[Haskell-cafe] Recursive instance dictionaries in GHC

2007-06-19 Thread Benja Fallenstein
Hi, I can't figure out why the following program compiles with this instance declaration instance Size (Maybe [a]) = Size [a] where size x = size (foo x) but has GHC loop forever with this one: instance (Foo a b, Size b) = Size a where size x = size (foo x) Anybody here know? Thanks, -

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

2007-06-19 Thread Jefferson Heard
I've read the documentation for some of the marshalling packages out there for Haskell, and I'm left confused as to which one I should be using and how to actually do what I want to do. I have a file, a little over 2gb, of packed data in the format (recordcount) records of: 4-byte int (count),

Re: [Haskell-cafe] Collections

2007-06-19 Thread Andrew Coppin
Jens Fisseler wrote: The equivalent of Haskell's list data type would be the array type of most imperative or object-oriented languages. Both are some sort of basic collection type, good for their own sake, but if you want more specialized collection types, you have to implement them.

Re: [Haskell-cafe] Collections

2007-06-19 Thread Andrew Coppin
*Albert Y. C. Lai wrote: * I am actually amazed that we have a comprehensive, widely-distributed package for graphs and graph algorithms. I can't say the same about other programming communities (they tend to re-implement it every time). Yeah... pitty the documentation isn't more

[Haskell-cafe] Avoiding Non-exhaustive patterns in function f

2007-06-19 Thread peterv
Haskell is known for its very strong static type checking, which eliminates a lot of runtime errors. But the following simple program crashes at runtime: data D = A | B f A = True main = print (f B) I understand this has nothing to do with type checking, but why can't the compiler

Re: [Haskell-cafe] Avoiding Non-exhaustive patterns in function f

2007-06-19 Thread Stefan O'Rear
On Tue, Jun 19, 2007 at 11:03:46PM +0200, peterv wrote: Haskell is known for its very strong static type checking, which eliminates a lot of runtime errors. But the following simple program crashes at runtime: data D = A | B f A = True main = print (f B) I understand this has

Re: [Haskell-cafe] Avoiding Non-exhaustive patterns in function f

2007-06-19 Thread Felipe Almeida Lessa
On 6/19/07, peterv [EMAIL PROTECTED] wrote: I understand this has nothing to do with type checking, but why can't the compiler give a warning about this? Or is this by design or because it is impossible to check with more complex recursive data types? Take a look at Catch from Neil Mitchell:

Re: [Haskell-cafe] Perl-style numeric type

2007-06-19 Thread Lennart Augustsson
I implemented a number type like that in Haskell ca 1992, called noddy numbers (I think John Hughes named them). I don't think I still have them, but it would be easy to do again. Except for the fact that there are so many way you and none of them are quite satisfactory. -- Lennart On

Re: [Haskell-cafe] Collections

2007-06-19 Thread Lennart Augustsson
I'm afraid I must agree with you a little. Many people use lists when a different data structure would have been better. It's a pity, because Haskell provides a large number of different data structures. On 6/19/07, Andrew Coppin [EMAIL PROTECTED] wrote: Jens Fisseler wrote: The equivalent

Re: [Haskell-cafe] Collections

2007-06-19 Thread David House
Andrew Coppin writes: Data.Graph -- graph type What would you use that for? (And what does it do?) It's for graphs, in the graph-theory [1] sense. The referenced page gives a list of example problems in the area, most of which are very practical. [1]:

Re: [Haskell-cafe] Collections

2007-06-19 Thread Brandon S. Allbery KF8NH
On Jun 19, 2007, at 16:23 , Andrew Coppin wrote: Jens Fisseler wrote: The equivalent of Haskell's list data type would be the array type of most imperative or object-oriented languages. Both are some sort of basic collection type, good for their own sake, but if you want more specialized

Re: [Haskell-cafe] Avoiding Non-exhaustive patterns in function f

2007-06-19 Thread Neil Mitchell
Hi I understand this has nothing to do with type checking, but why can't the compiler give a warning about this? Or is this by design or because it is impossible to check with more complex recursive data types? Take a look at Catch from Neil Mitchell:

Re: [Haskell-cafe] Collections

2007-06-19 Thread David House
Andrew Coppin writes: Maybe it's just a culture thing then... In your typical OOP language, you spend five minutes thinking now, what collection type shall I use here? before going on to actually write the code. In Haskell, you just go OK, so I'll put a list here... The design stage of

Re: [Haskell-cafe] Useful IDE features -

2007-06-19 Thread Claus Reinke
That looks nice, just unfortunate you need to cast to ::Float in homer2?Age::Float. I don't see why this is needed, but I must say I don't understand your code completely yet, working on that :) that annotation is not needed if you keep the functional dependency (which just states that record

Re: [Haskell-cafe] Collections

2007-06-19 Thread Derek Elkins
On Tue, 2007-06-19 at 18:49 -0400, Brandon S. Allbery KF8NH wrote: On Jun 19, 2007, at 16:23 , Andrew Coppin wrote: Jens Fisseler wrote: The equivalent of Haskell's list data type would be the array type of most imperative or object-oriented languages. Both are some sort of basic

Re: [Haskell-cafe] Collections

2007-06-19 Thread Creighton Hogg
A lot of people have had comments on this thread, but I have a off-hand question: what data types are required by the 98 standard? I figured it was just lists tuples because they have syntactic support, but is that true? Thanks, Creighton ___

Re: [Haskell-cafe] Collections

2007-06-19 Thread Stefan O'Rear
On Tue, Jun 19, 2007 at 06:42:22PM -0500, Creighton Hogg wrote: A lot of people have had comments on this thread, but I have a off-hand question: what data types are required by the 98 standard? I figured it was just lists tuples because they have syntactic support, but is that true?

Re: [Haskell-cafe] Perl-style numeric type

2007-06-19 Thread Brent Yorgey
Good to know I'm only 15 years behind the times. =) Well, I think I'll continue with my implementation (at the very least it's an interesting way to learn about all the numeric classes in the Prelude), although I'll be interested in your comments when I get around to releasing it. I don't

Re: [Haskell-cafe] Perl-style numeric type

2007-06-19 Thread Tom Phoenix
On 6/19/07, Brent Yorgey [EMAIL PROTECTED] wrote: I've started developing a library to support a Perl-style numeric type that does the right thing without having to worry too much about types. But before I get too far (it looks like it will be straightforward yet tedious to implement), I

Re: [Haskell-cafe] hSetBuffering woes

2007-06-19 Thread Donald Bruce Stewart
eeoam: Bryan O'Sullivan wrote: Eric wrote: I'm writing a simple HTTP server and am trying to implement the POST method. That's a rather general problem statement, indeed :-) For an application like this, I'd suggest that explicit resource management is the way to go, and that you

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

2007-06-19 Thread Donald Bruce Stewart
jeff: I've read the documentation for some of the marshalling packages out there for Haskell, and I'm left confused as to which one I should be using and how to actually do what I want to do. I have a file, a little over 2gb, of packed data in the format (recordcount) records of:

[Haskell-cafe] haskell crypto is reaaaaaaaaaally slow

2007-06-19 Thread Anatoly Yakovenko
$ time ./md5sum ./md5sum [105,252,52,138,187,192,216,17,225,123,185,3,124,101,86,132] real0m4.790s user0m3.688s sys 0m0.492s $ time md5sum ./md5sum 69fc348abbc0d811e17bb9037c655684 ./md5sum real0m0.023s user0m0.000s sys 0m0.008s this is my implementation using crypto

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

2007-06-19 Thread Donald Bruce Stewart
aeyakovenko: $ time ./md5sum ./md5sum [105,252,52,138,187,192,216,17,225,123,185,3,124,101,86,132] real0m4.790s user0m3.688s sys 0m0.492s $ time md5sum ./md5sum 69fc348abbc0d811e17bb9037c655684 ./md5sum real0m0.023s user0m0.000s sys 0m0.008s this is my

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

2007-06-19 Thread Anatoly Yakovenko
module Main where import System import qualified Data.Digest.MD5 as MD5 import qualified Data.ByteString as BS main = do args - getArgs dt - BS.readFile $ head args putStrLn $ show $ MD5.hash . BS.unpack $ dt ^

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

2007-06-19 Thread Stefan O'Rear
On Wed, Jun 20, 2007 at 01:24:00PM +1000, Donald Bruce Stewart wrote: aeyakovenko: $ time ./md5sum ./md5sum [105,252,52,138,187,192,216,17,225,123,185,3,124,101,86,132] real0m4.790s user0m3.688s sys 0m0.492s $ time md5sum ./md5sum 69fc348abbc0d811e17bb9037c655684

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

2007-06-19 Thread Donald Bruce Stewart
dons: aeyakovenko: $ time ./md5sum ./md5sum [105,252,52,138,187,192,216,17,225,123,185,3,124,101,86,132] real0m4.790s user0m3.688s sys 0m0.492s $ time md5sum ./md5sum 69fc348abbc0d811e17bb9037c655684 ./md5sum real0m0.023s user0m0.000s sys

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

2007-06-19 Thread Donald Bruce Stewart
stefanor: On Wed, Jun 20, 2007 at 01:24:00PM +1000, Donald Bruce Stewart wrote: aeyakovenko: $ time ./md5sum ./md5sum [105,252,52,138,187,192,216,17,225,123,185,3,124,101,86,132] real0m4.790s user0m3.688s sys 0m0.492s $ time md5sum ./md5sum

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

2007-06-19 Thread Donald Bruce Stewart
aeyakovenko: $ time ./md5sum ./md5sum [105,252,52,138,187,192,216,17,225,123,185,3,124,101,86,132] real0m4.790s user0m3.688s sys 0m0.492s $ time md5sum ./md5sum 69fc348abbc0d811e17bb9037c655684 ./md5sum real0m0.023s user0m0.000s sys

Re: [Haskell-cafe] Haskell, crypto and OpenSSL

2007-06-19 Thread Donald Bruce Stewart
dons: -- Fast md5 using OpenSSL and non-copying bytestrings md5sum :: B.ByteString - String md5sum p = unsafePerformIO $ B.unsafeUseAsCStringLen p $ \(ptr,n) - do digest - c_md5 ptr (fromIntegral n) nullPtr liftM concat $ forM [0..15] $ \n - do