Re[2]: [Haskell-cafe] Speed of character reading in Haskell

2007-09-10 Thread Bulat Ziganshin
Hello Neil, Monday, September 10, 2007, 3:49:06 AM, you wrote: I'm sure it's true, but it's quite irrelevant to my question, which is why is using getChar so much slower than using getContents? Buffering, blocks and locks. in ghc, is entirely due to locking, which is the slowest operation

Re: [Haskell-cafe] Comments and/or Criticisms

2007-09-10 Thread Brandon S. Allbery KF8NH
On Sep 10, 2007, at 1:47 , Stuart Cook wrote: On 9/10/07, PR Stanley [EMAIL PROTECTED] wrote: --count occurrences of chars in string countCS :: [Char] - [(Char, Int)] countCS xs = [(x, (countC x xs)) | x - [' '..'z'], (countC x xs) 0] A few things to note: My naive take on it: import

Re[2]: [Haskell-cafe] Speed of character reading in Haskell

2007-09-10 Thread Bulat Ziganshin
Hello ok, Monday, September 10, 2007, 6:09:27 AM, you wrote: Locks: getChar has to acquire locks, as does getContents. However, because getContents can operate on blocks, this requires many fewer locks. What's to lock against? I'm writing single-threaded code. unfortunately, there is one

Re[2]: [Haskell-cafe] zip, map and zipWith for arrays

2007-09-10 Thread Bulat Ziganshin
Hello ok, Monday, September 10, 2007, 7:03:34 AM, you wrote: (What's the best thing to read to explain functional dependencies for multi-parameter type classes?) ghc 6.6+ docs. but 1) arrays don't use FDs 2) FDs are old technique. starting with ghc 6.8, ATs will be available and should be

Re: [Haskell-cafe] Tiny documentation request

2007-09-10 Thread Sven Panne
On Sunday 09 September 2007 18:41, Andrew Coppin wrote: [...] Well, if I could collapse it with a single click, it would be much easier to scroll past it and get to the thing I'm looking for. I didn't say remove it, just give me the option to hide it. ;-) OK, that shouldn't be too hard to

Re: [Haskell-cafe] Comments and/or Criticisms

2007-09-10 Thread rahn
countCS :: [Char] - [(Char, Int)] I use this count :: (Ord a, Num b) = [a] - (a - b,[(a,b)]) count xs = ( flip (Map.findWithDefault 0) m , Map.assocs m ) where m = Map.fromListWith (+) $ zip xs $ repeat 1 which returns the frequencies list as well as a query function that I found

Re: [Haskell-cafe] Custom unary operator extension?

2007-09-10 Thread Henning Thielemann
On Sun, 9 Sep 2007, Peter Verswyvelen wrote: Henning Thielemann wrote: The more syntactic constructs exist, the more complicated it becomes to read such programs. Today, if you read a symbolic operator which is not -, not a single dot with a capital identifier to the left (qualification),

Re: [Haskell-cafe] Tiny documentation request

2007-09-10 Thread manu
Neil Mitchell wrotes : Replicating actual tables with CSS is a nightmare - you shouldn't use table's for lots of things, I agree but there are sometimes when it really is the best option. Which isn't the case here ! Nested lists would easily do the trick... Fixing up the CSS and still

RE: [Haskell-cafe] Custom unary operator extension?

2007-09-10 Thread Simon Peyton-Jones
Incidentally, GHC does allow postfix unary operators. http://www.haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#postfix-operators Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Data.Binary Endianness

2007-09-10 Thread Adrian Neumann
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 I try to write a Windows Bitmap File using Data.Binary, but I have some trouble. For example, the internet states, that the magic number, that puts 'BM' in the first two bytes of the file is 19778. But when I put (19778::Word16) I get 'MB'

Re: [Haskell-cafe] Data.Binary Endianness

2007-09-10 Thread Jules Bean
Adrian Neumann wrote: For example, the internet states, that the magic number, that puts 'BM' in the first two bytes of the file is 19778. But when I put (19778::Word16) I get 'MB' instead. I read on the german Wikipedia, that bmp uses little endian encoding, but Data.Binary uses big endian.

Re: [Haskell-cafe] Custom unary operator extension?

2007-09-10 Thread Peter Verswyvelen
Nice. Thanks for the info, but the symbolic notation is not the only reason for using Haskell, it's also to force them into solving simple problems without using mutable variables, so they see this alternative functional programming approach BEFORE they are specialist in C++, because then they

[Haskell-cafe] ANN: The Monad.Reader - Issue 8

2007-09-10 Thread Wouter Swierstra
I am pleased to announce that the latest issue of The Monad.Reader is now available: http://www.haskell.org/haskellwiki/The_Monad.Reader Issue 8 consists of the following two articles: * Brent Yorgey Generating Multiset Partitions * Conrad Parker Type-Level Instant Insanity

Re: [Haskell-cafe] Installation of GLUT package

2007-09-10 Thread Paul L
On 9/9/07, Ronald Guida [EMAIL PROTECTED] wrote: Good news: I abandoned GLUT and looked at GLFW. I had similar problems getting GLFW to work with GHC and GHCi. After a bunch of hacking, I got GLFW to work for me. Glad to hear it, but please let me know what problems you had. GLFW doesn't

[Haskell-cafe] WinHugs shortcut keys

2007-09-10 Thread Peter Verswyvelen
Winhugs seems to have some shortcut keys, like F5 for run. It does not seem to have shortcut keys for reload, edit, etc... These would be really handy. It is possible to customize the shortcuts assigned to the commands? If not, can it be build from source? Thanks, Peter

Re: [Haskell-cafe] WinHugs shortcut keys

2007-09-10 Thread Neil Mitchell
Hi Peter, It does not seem to have shortcut keys for reload, edit, etc... When do you use reload? WinHugs automatically reloads modified files, so I've never felt the need to reload things. Similarly for edit, typing just edit on its own isn't that useful unless you give it a module. However,

Re: [Haskell-cafe] WinHugs shortcut keys

2007-09-10 Thread Peter Verswyvelen
Hi Neil, This is so silly, I just switched from Helium to WinHugs and did not realize it performed automatic reloading. As Helium provides shortcut keys for reload and edit, I just got confused. I should have RTFM! Automatic reloading is of course THE best solution, and that's already in

Re: [Haskell-cafe] Tiny documentation request

2007-09-10 Thread Brent Yorgey
Just bookmark: http://haskell.org/hoogle It's not perfect, but it probably solves lots of your problems. And if you use Firefox, you can even install Hoogle as one of the search engines in the upper-right search box. Nice and fast! -Brent ___

Re: [Haskell-cafe] Data.Binary Endianness

2007-09-10 Thread Thomas Schilling
On Mon, 2007-09-10 at 11:10 +0100, Jules Bean wrote: The docs are not as well interlinked as you might hope. In fact, the docs on hackage are interlinked nicely. That is, for packages for which the documentation builds. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Data.Binary Endianness

2007-09-10 Thread Jules Bean
Thomas Schilling wrote: On Mon, 2007-09-10 at 11:10 +0100, Jules Bean wrote: The docs are not as well interlinked as you might hope. In fact, the docs on hackage are interlinked nicely. That is, for packages for which the documentation builds. On the documentation page:

Re: [Haskell-cafe] WinHugs shortcut keys

2007-09-10 Thread Neil Mitchell
Hi Peter, Automatic reloading is of course THE best solution, and that's already in :-) Maybe it could help new users to display a simple message into the WinHugs statusbar like module XXX reloaded after external modification at HH:MM:SS) or something? But that's really minor. That would be

Re: [Haskell-cafe] Data.Binary Endianness

2007-09-10 Thread Sven Panne
On Monday 10 September 2007 17:17, Jules Bean wrote: On the documentation page: http://www.cse.unsw.edu.au/~dons/binary/Data-Binary.html [...] Just a small hint: That page seems to be out of date compared to: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-0.3 The

Re: [Haskell-cafe] Data.Binary Endianness

2007-09-10 Thread Thomas Schilling
On Mon, 2007-09-10 at 16:17 +0100, Jules Bean wrote: Thomas Schilling wrote: On Mon, 2007-09-10 at 11:10 +0100, Jules Bean wrote: The docs are not as well interlinked as you might hope. In fact, the docs on hackage are interlinked nicely. That is, for packages for which the

Re: [Haskell-cafe] Data.Binary Endianness

2007-09-10 Thread Thomas Schilling
On Mon, 2007-09-10 at 18:11 +0200, Sven Panne wrote: On Monday 10 September 2007 17:17, Jules Bean wrote: On the documentation page: http://www.cse.unsw.edu.au/~dons/binary/Data-Binary.html [...] Just a small hint: That page seems to be out of date compared to:

[Haskell-cafe] Second Request for code review - Knuth Morris Pratt for Data.Sequence

2007-09-10 Thread Justin Bailey
Using the code developed for ByteStrings by myself, Christ Kuklewicz and Daniel Fischer, I've implemented Knuth-Morris-Pratt substring searching on Data.Sequence Seq values. Attached you'll find the library in kmp.zip.safe. The algorithm is implemented in the module Data.Sequence.KMP. At the

[Haskell-cafe] Functional dependencies conflict between instance declarations

2007-09-10 Thread Peter Verswyvelen
The Haskell mailing list seems to be filled with people requesting information about this error, so I cannot resist to include myself in it ;-) I've read the information about funcdeps in the GHC user guide, and I think I understand how it works, but I get the error a lot, without having a

Re: [Haskell-cafe] Data.Binary Endianness

2007-09-10 Thread Sven Panne
On Monday 10 September 2007 18:21, Thomas Schilling wrote: On Mon, 2007-09-10 at 18:11 +0200, Sven Panne wrote: [...] The library looks quite nice, but I'm missing support for reading/writing Int{8,16,32,64} maybe this?

Re: [Haskell-cafe] Data.Binary Endianness

2007-09-10 Thread Don Stewart
sven.panne: On Monday 10 September 2007 18:21, Thomas Schilling wrote: On Mon, 2007-09-10 at 18:11 +0200, Sven Panne wrote: [...] The library looks quite nice, but I'm missing support for reading/writing Int{8,16,32,64} maybe this?

Re: [Haskell-cafe] Data.Binary Endianness

2007-09-10 Thread Don Stewart
nominolo: On Mon, 2007-09-10 at 16:17 +0100, Jules Bean wrote: Thomas Schilling wrote: On Mon, 2007-09-10 at 11:10 +0100, Jules Bean wrote: The docs are not as well interlinked as you might hope. In fact, the docs on hackage are interlinked nicely. That is, for packages for

Re: [Haskell-cafe] simple parsing (parsec) intro

2007-09-10 Thread Justin Bailey
On 9/9/07, Tim Newsham [EMAIL PROTECTED] wrote: I wrote a small intro about how to write a parser in haskell. Its basically about parsec and how it works, but its written without directly referencing parsec and aimed towards beginners (basically wrote it for some friends). Nice development of

Re: [Haskell-cafe] Data.Binary Endianness

2007-09-10 Thread Thomas Schilling
On Mon, 2007-09-10 at 18:40 +0200, Sven Panne wrote: Type classes might be used to get a slightly smaller API, but I am unsure about the performance impact and how much this would really buy us in terms of the ease of use of the API. There shouldn't be any problem w.r.t. performance, the

[Haskell-cafe] Haddock/hscolour integration broken on Hackage?

2007-09-10 Thread David Menendez
I was looking at the Data.Binary documentation[1] on Hackage, and I've noticed some problems with the associated source listings[2]. First, none of the Source links work. They all refer to fragment IDs (e.g., #Binary) that are not defined. I'm not sure if this is a problem with hscolor, haddock,

Re: [Haskell-cafe] Functional dependencies conflict between instance declarations

2007-09-10 Thread Peter Verswyvelen
Never mind, that GHC compiler was again more clever than me, sigh. That's really frustrating about Haskell: the compiler captures so many errors at compile time, that newbies hardly get anything done, it's a constant battle against the errors. But once it compiles, it usually works at runtime

Re: [Haskell-cafe] Where would I find fromInt?

2007-09-10 Thread Andrew Coppin
Albert Y. C. Lai wrote: To the tune of the theme song of Ghostbusters: You've got an Int But you want Double Who do you call? fromIntegral! Let it never, *never* be said that math nerds don't have humour... ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Custom unary operator extension?

2007-09-10 Thread Michael Vanier
APL is fairly obsolete now anyway. A more modern version of that language is J (www.jsoftware.com), which does not use special characters. I've studied the language a bit, and it's quite interesting, but it really doesn't offer much (anything?) over Haskell except a much terser notation and

Re: [Haskell-cafe] Haddock/hscolour integration broken on Hackage?

2007-09-10 Thread Thomas Schilling
On Mon, 2007-09-10 at 14:11 -0400, David Menendez wrote: I was looking at the Data.Binary documentation[1] on Hackage, and I've noticed some problems with the associated source listings[2]. First, none of the Source links work. They all refer to fragment IDs (e.g., #Binary) that are not

Re: [Haskell-cafe] zip, map and zipWith for arrays

2007-09-10 Thread Andrew Coppin
ok wrote: On 9 Sep 2007, at 10:05 pm, Axel Gerstenberger wrote: I am used to work with map, zip and zipWith, when working with lists, however, I could not find such functions for Arrays. They aren't there for at least two reasons. (1) They are easy to implement on top of the operations that

Re: [Haskell-cafe] Custom unary operator extension?

2007-09-10 Thread Peter Verswyvelen
Thanks for the advice. Well, if I wanted to use a language with rich mathematical symbol support, I would use Sun's Fortress, which allows any unicode character. But that language is scheduled to be released by 2010, if it gets released. An interpreter is available though. But I'll stick to

Re: [Haskell-cafe] Tiny documentation request

2007-09-10 Thread Andrew Coppin
Sven Panne wrote: On Sunday 09 September 2007 18:41, Andrew Coppin wrote: Oh goodie... So it's there to keep the machines happy? No, it's there to keep *me* happy when I'm looking for a module. ;-) Well, there's over 200 modules relating to graph theory alone. (Modules that I

Re: [Haskell-cafe] Tiny documentation request

2007-09-10 Thread Andrew Coppin
Brent Yorgey wrote: And if you use Firefox, you can even install Hoogle as one of the search engines in the upper-right search box. Nice and fast! I've never really understood what the benefit of this is... I mean, Google make the Google toolbar, but what's the point? Why not just click on

Re: [Haskell-cafe] Data.Binary Endianness

2007-09-10 Thread Andrew Coppin
Don Stewart wrote: sven.panne: Of course I can *implement* everything on top of this, but this is not the point. The binary library should have builtin support for more data types, and this is probably not hard to implement. Yeah, just send patches against the darcs repo for either

Re: [Haskell-cafe] Functional dependencies conflict between instance declarations

2007-09-10 Thread Andrew Coppin
Peter Verswyvelen wrote: Never mind, that GHC compiler was again more clever than me, sigh. That's really frustrating about Haskell: the compiler captures so many errors at compile time, that newbies hardly get anything done, it's a constant battle against the errors. But once it compiles, it

Re: [Haskell-cafe] Tiny documentation request

2007-09-10 Thread Ian Lynagh
On Sun, Sep 09, 2007 at 05:38:03PM +0200, Sven Panne wrote: On Sunday 09 September 2007 16:40, Andrew Coppin wrote: I have the following page bookmarked: http://haskell.org/ghc/docs/latest/html/libraries/ I'd like to ask 2 things. 1. Would it be possible to make the *huge* list of

Re: [Haskell-cafe] Haddock/hscolour integration broken on Hackage?

2007-09-10 Thread Malcolm Wallace
David Menendez [EMAIL PROTECTED] writes: I was looking at the Data.Binary documentation[1] on Hackage, and I've noticed some problems with the associated source listings[2]. First, none of the Source links work. They all refer to fragment IDs (e.g., #Binary) that are not defined. I'm not

Re: [Haskell-cafe] Tiny documentation request

2007-09-10 Thread Thomas Schilling
On Mon, 2007-09-10 at 20:28 +0100, Ian Lynagh wrote: Would it be better to have a separate page with a package index, containing the description of each package and a link to each of the modules that it provides? +1 ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Tiny documentation request

2007-09-10 Thread Thomas Schilling
On Mon, 2007-09-10 at 19:51 +0100, Andrew Coppin wrote: Brent Yorgey wrote: And if you use Firefox, you can even install Hoogle as one of the search engines in the upper-right search box. Nice and fast! I've never really understood what the benefit of this is... I mean, Google make the

Re: [Haskell-cafe] Tiny documentation request

2007-09-10 Thread Neil Mitchell
Hi I've never really understood what the benefit of this is... I mean, Google make the Google toolbar, but what's the point? Why not just click on the Google bookmark and type in your search? What benefits does installing a special addon provide? You can setup firefox so in the location

Re: [Haskell-cafe] Tiny documentation request

2007-09-10 Thread Brent Yorgey
Well, for the default Google searchbox the advantage is: Ctrl-K search phrase ENTER versus grab mouse .. point ... click ... move hand back to keyboard ... type search phrase, ENTER I never used any of the secondary search bars. Unless I can define a shortcut to access hoogle

Re: [Haskell-cafe] Tiny documentation request

2007-09-10 Thread Andrew Coppin
Neil Mitchell wrote: Hi re: Hoogle not always getting it exactly right, there are a few known bugs floating around which I'm working on. Hoogle can permute the order of arguments though, so that shouldn't be a problem. It doesn't really like Monads, but I wrote Hoogle before I was aware of

Re: [Haskell-cafe] Comments and/or Criticisms

2007-09-10 Thread Derek Elkins
On Mon, 2007-09-10 at 15:47 +1000, Stuart Cook wrote: On 9/10/07, PR Stanley [EMAIL PROTECTED] wrote: Hi Any comments and/or criticisms would be most appreciated: --count the occurrences of char in string countC :: Char - [Char] - Int countC x xs = sum [1 | c - xs, c == x] That's a

Re: [Haskell-cafe] Elevator pitch for Haskell.

2007-09-10 Thread Brian Hurt
On Mon, 10 Sep 2007, Devin Mullins wrote: Brian Hurt wrote: Any links to these presentations? I'm interested. Videos: http://rubyhoedown2007.confreaks.com/session04.html Actually, this video has an interesting bit, relevent to this discussion. He doesn't phrase it as an elevator pitch,

Re: [Haskell-cafe] Elevator pitch for Haskell.

2007-09-10 Thread Kim-Ee Yeoh
Devin Mullins wrote: As for the latter, the reason I hear most often is I want to be able to use the language at my job.* -- snip -- * This is somewhat odd, as the strong majority of vocal Rubyists /are/ using it at their job. Not without risk though. Their necks get wrung if things

[Haskell-cafe] Re: ((a - b) - c) - (a - m b) - m c

2007-09-10 Thread apfelmus
Henning Thielemann wrote: On Sun, 9 Sep 2007, Stuart Cook wrote: When combining monadic and non-monadic code, I've often wished for a magical combinator of type (Monad m) = ((a - b) - c) - (a - m b) - m c which would let me inject a monadic function into a pure one, then wrap the ultimate

[Haskell-cafe] Re: Help understanding type error

2007-09-10 Thread Benjamin Franksen
Derek Elkins wrote: On Sat, 2007-09-08 at 12:24 +1000, Stuart Cook wrote: On 9/8/07, Ryan Ingram [EMAIL PROTECTED] wrote: This does what you want, I think: {-# LANGUAGE ExistentialQuantification #-} module Exist where data Showable = forall a. (Show a) = Showable a instance Show

[Haskell-cafe] Re: Elevator pitch for Haskell.

2007-09-10 Thread Aaron Denney
On 2007-09-08, Neil Mitchell [EMAIL PROTECTED] wrote: All these things are minor. The Prelude numeric classes aren't broken - they don't quite match what a mathematician might have picked, but its certainly easy enough to do numeric operations! They can be used, but they don't break down in

[Haskell-cafe] Re: Data.Binary Endianness

2007-09-10 Thread apfelmus
Sven Panne wrote: So what I was asking for is: getInt32be, putIEEEFloatLe, getIEEEDoubleHost, ... Type classes might be used to get a slightly smaller API, but I am unsure about the performance impact and how much this would really buy us in terms of the ease of use of the API. It's