Re: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-01 Thread Henning Thielemann
On Fri, 1 Feb 2008, Cale Gibbard wrote: Hello, Today on #haskell, resiak was asking about a clean way to write the function which allocates an array of CStrings using withCString and withArray0 to produce a new with* style function. I came up with the following: nest :: [(r - a) - a] -

[Haskell-cafe] Re: derive Pretty?

2008-02-01 Thread Christian Maeder
Greg Fitzgerald wrote: Is it possible to automatically derive instances of Pretty http://haskell.org/ghc/docs/latest/html/libraries/haskell-src/Language-Haskell-Pretty.html? If no, what do most do when it comes to pretty-printing large data types? We do it manually. Usually you have to

Re: [Haskell-cafe] anybody can tell me the pronuncation of haskell?

2008-02-01 Thread Benjamin L. Russell
Here in Japan, it's pronounced in four syllables with no accent, as follows: Hah (as in Hah, I see.) Sue (as in the name) Ke (as in the first syllable of ketchup) Ru (as in the first syllable of Lucas, since there is no difference between l and r sounds in Japanese) Put together, it sounds as

[Haskell-cafe] Announce: CC-delcont 0.2

2008-02-01 Thread Dan Doel
Hello all, After much distraction and laziness on my part (my apologies), I have finally gotten around to putting together a new release of the delimited continuations library CC-delcont. It is now available on hackage. Relevant changes include: * Now builds in GHC-6.8.x * Builds with

[Haskell-cafe] Data.Ord and Heaps (Was: Why functional programming matters)

2008-02-01 Thread apfelmus
Stephan Friedrichs wrote: apfelmus wrote: [...] Feedback: I think the HeapPolicy thing is too non-standard. The canonical way would be to use a MinHeap and let the Ord instance handle everything. A MaxHeap can then be obtained via a different Ord instance newtype Ord a = Reverse a =

Re: [Haskell-cafe] Re: hxt memory useage

2008-02-01 Thread Malcolm Wallace
Rene de Visser [EMAIL PROTECTED] wrote: Even if you replace parsec, HXT is itself not incremental. (It stores the whole XML document in memory as a tree, and the tree is not memory effecient. If the usage pattern of the tree is search-and-discard, then only enough of the tree to satisfy the

Re: [Haskell-cafe] Re: anybody can tell me the pronuncation of?haskell?

2008-02-01 Thread Benjamin L. Russell
According to the Gogen Yurai Jiten (Etymology Derivation Dictionary) (http://gogen-allguide.com/a/arigatou.html), the etymology of arigato (arigatou when entered into a Japanese input method editor, such as Kotoeri) is as follows (at the risk of moji-bake (garbled text), I have included the

[Haskell-cafe] Cabal, GHC, FFI and Visual Studio on Windows

2008-02-01 Thread Magnus Therning
Is it possible to get Cabal to use 'cl' (Microsoft's C/C++ compiler shipped with Visual Studio Express)? I've found the Wiki page on using Visual Studio to create a DLL, then convert it to a .a file so that GHC can consume it. I'd rather skip using Visual Studio to build things and just ship a

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-01 Thread Alfonso Acosta
On Jan 31, 2008 11:35 PM, Wolfgang Jeltsch [EMAIL PROTECTED] wrote: Am Donnerstag, 31. Januar 2008 18:30 schrieb Dominic Steinitz: Look at http://sneezy.cs.nott.ac.uk/fun/feb-07/jeremy-slides.pdf This is essentially what I had in mind. While Oleg's implementation needs a thrusted core,

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-01 Thread Alfonso Acosta
What about FixedVector for the vector library and DecTypArith (maybe too long) or DecTypes for the type-level decimal arithmetic library? Actually it would maybe be better to create common high-level interface that could include unary, binary and decimal arithmetic so that the library could be

Re: [Haskell-cafe] Simple network client

2008-02-01 Thread Jules Bean
Jonathan Cast wrote: On 31 Jan 2008, at 1:23 AM, Reinier Lamers wrote: Bayley, Alistair wrote: More than one person has posted previously about the flaws and traps of lazy IO. A common position seems to be don't do lazy IO. Still, when I was browsing the Haskell' wiki a few days ago, I

Re: Cryptographic hash uniquness (was [Haskell-cafe] Simple network client)

2008-02-01 Thread Richard Kelsall
Bulat Ziganshin wrote: Hello Peter, Thursday, January 31, 2008, 8:01:36 PM, you wrote: files with different content generating the same hash)... My intuition told me that the odds of two cryptographic hashes (on meaningful content) colliding was much less than the earth being destroyed by an

[Haskell-cafe] Who started 42, and when?

2008-02-01 Thread Loup Vaillant
I have read quite a lot of Haskell papers, lately, and noticed that the number 42 appeared quite often, in informal tutorials as well as in very serious research papers. No wonder Haskell is the Answer to The Great Question of Life, The Universe, and Everything, but I would like to know who

Re: [Haskell-cafe] Who started 42, and when?

2008-02-01 Thread Janis Voigtlaender
Denis Bueno wrote: On Fri, Feb 1, 2008 at 9:03 AM, Loup Vaillant [EMAIL PROTECTED] wrote: I have read quite a lot of Haskell papers, lately, and noticed that the number 42 appeared quite often, in informal tutorials as well as in very serious research papers. No wonder Haskell is the Answer to

Re: [Haskell-cafe] fast graph algorithms without object identities

2008-02-01 Thread Alfonso Acosta
You'd probably be interested to read http://www.cs.chalmers.se/~koen/pubs/entry-asian99-lava.html On Jan 31, 2008 9:56 PM, Jan-Willem Maessen [EMAIL PROTECTED] wrote: On Jan 31, 2008, at 5:39 AM, Henning Thielemann wrote: It seems that algorithms on graphs can be implemented particularly

Re: [Haskell-cafe] Who started 42, and when?

2008-02-01 Thread Phil Molyneux
Hi --- The arbitrary constant was made popular by Douglas Adams in the mid-1970s radio series ``A Hitchhikers Guide to the Galaxy'' (a trilogy in 4 parts) --- however it does have a basis in the standard model of physics --- a paper in Phys.Rev. of the early 1970s described the unification

Re: [Haskell-cafe] Who started 42, and when?

2008-02-01 Thread Christopher L Conway
On Feb 1, 2008 9:27 AM, Loup Vaillant [EMAIL PROTECTED] wrote: I suspected this. Just that I didn't noticed 42 but in Haskell papers. Maybe this is just a bias due to my recent interests. I should check some C/C++/Lisp/Ocaml papers. About the library search, Maybe it is possible to try a

Re: [Haskell-cafe] Who started 42, and when?

2008-02-01 Thread Denis Bueno
On Fri, Feb 1, 2008 at 9:03 AM, Loup Vaillant [EMAIL PROTECTED] wrote: I have read quite a lot of Haskell papers, lately, and noticed that the number 42 appeared quite often, in informal tutorials as well as in very serious research papers. No wonder Haskell is the Answer to The Great

Re: [Haskell-cafe] Who started 42, and when?

2008-02-01 Thread Denis Bueno
On Fri, Feb 1, 2008 at 9:19 AM, Janis Voigtlaender [EMAIL PROTECTED] wrote: I think Loup is aware of the hitchhiker books (see the reference to the Great Question of ... Everything). Ah, I didn't read that correctly. I assumed that something he read something that had described Haskell as

Re: [Haskell-cafe] Who started 42, and when?

2008-02-01 Thread Loup Vaillant
2008/2/1, Christopher L Conway [EMAIL PROTECTED]: Loup, This is not unique to the Haskell community. I suspect the arbitrary constant 42 has been appearing unexplained in research papers for as long as there have been computer scientists who were sci-fi geeks (absolutely no offense intended

Re: [Haskell-cafe] Who started 42, and when?

2008-02-01 Thread Christopher L Conway
Loup, This is not unique to the Haskell community. I suspect the arbitrary constant 42 has been appearing unexplained in research papers for as long as there have been computer scientists who were sci-fi geeks (absolutely no offense intended to geeks ;-). It would be very difficult indeed to

[Haskell-cafe] Re: A handy little consequence of the Cont monad

2008-02-01 Thread ChrisK
The bit of a mess that comes from avoiding monads is (my version): import Foreign.Marshal.Array(withArray0) import Foreign.Ptr(nullPtr,Ptr) import Foreign.C.String(withCString,CString) This uses withCString in order of the supplied strings, and a difference list ([CString]-[CString])

Re: [Haskell-cafe] Who started 42, and when?

2008-02-01 Thread Tim Chevalier
To pre-empt the next couple of questions, the numbers 17 and 23 are from _The Illuminatus! Trilogy_ by Robert Shea and Robert Anton Wilson, and the number 37 is from the Jersey Trilogy of movies by Kevin Smith. Cheers, Tim -- Tim Chevalier * http://cs.pdx.edu/~tjc * Often in error, never in

Re: [Haskell-cafe] Who started 42, and when?

2008-02-01 Thread Colin Paul Adams
Phil == Phil Molyneux [EMAIL PROTECTED] writes: Phil Adams was interested in computing --- I think his reaction Phil to being told about functional programming was to wonder Phil what non-functional programming might be. Curiously, that was my reaction too when i first heard of the

Re: [Haskell-cafe] fast graph algorithms without object identities

2008-02-01 Thread Jan-Willem Maessen
On Feb 1, 2008, at 9:41 AM, Alfonso Acosta wrote: You'd probably be interested to read http://www.cs.chalmers.se/~koen/pubs/entry-asian99-lava.html It is indeed an interesting paper (that I've read and referred to several times over the years). But it's tricky to get right in practice!

[Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-01 Thread Aaron Denney
On 2008-02-01, Bjorn Buckwalter [EMAIL PROTECTED] wrote: If Naturals had been sufficient for me I wouldn't have done my own implementation (I'm unaware of any other implementation of Integers). And there is certainly a lot of value to the clearer error messages from a decimal representation.

Re: [Haskell-cafe] reading from the cdrom drive on Red Hat

2008-02-01 Thread Adam Langley
2008/2/1 Galchin Vasili [EMAIL PROTECTED]: I wrote a simple program to read the contents of a cdrom: (Note that this is a terribly inefficient way of reading large amounts of binary data. Of course, if this is just meant as an example, that's fine. Otherwise, see the struff about

[Haskell-cafe] reading from the cdrom drive on Red Hat

2008-02-01 Thread Galchin Vasili
Hello, I wrote a simple program to read the contents of a cdrom: module Main where import Text.Printf import System.IO import System.Posix.Types import System.Posix.IO main = do fd - openFd /dev/cdrom ReadOnly Nothing defaultFileFlags readCdRom fd 4096 closeFd fd

Re: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-01 Thread Derek Elkins
On Fri, 2008-02-01 at 00:09 -0500, Cale Gibbard wrote: Hello, Today on #haskell, resiak was asking about a clean way to write the function which allocates an array of CStrings using withCString and withArray0 to produce a new with* style function. I came up with the following: nest ::

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-01 Thread Wolfgang Jeltsch
Am Freitag, 1. Februar 2008 05:11 schrieben Sie: Wolfgang Jeltsch wrote: Well, the representation (D1,D2,D9) might be considered more readable. It has the disadvantage of a fixed maximum size for the numbers. Which takes me to a point I had already considered some time ago: Wouldn’t it

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-01 Thread Wolfgang Jeltsch
Am Freitag, 1. Februar 2008 13:09 schrieben Sie: What about FixedVector for the vector library and DecTypArith (maybe too long) or DecTypes for the type-level decimal arithmetic library? Actually it would maybe be better to create common high-level interface that could include unary, binary

Re: [Haskell-cafe] reading from the cdrom drive on Red Hat

2008-02-01 Thread Galchin Vasili
Thank you Adam and Bradley. My program is my getting a feel of how to open a Linux and do block reads. Just conceptual Vasili On 2/1/08, Adam Langley [EMAIL PROTECTED] wrote: On Feb 1, 2008 1:42 PM, Bryan O'Sullivan [EMAIL PROTECTED] wrote: No, it's the Haskell runtime turning a -1 return

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-01 Thread Wolfgang Jeltsch
Am Freitag, 1. Februar 2008 13:00 schrieb Alfonso Acosta: On Jan 31, 2008 11:35 PM, Wolfgang Jeltsch [EMAIL PROTECTED] wrote: Am Donnerstag, 31. Januar 2008 18:30 schrieb Dominic Steinitz: Look at http://sneezy.cs.nott.ac.uk/fun/feb-07/jeremy-slides.pdf This is essentially what I

Re: [Haskell-cafe] reading from the cdrom drive on Red Hat

2008-02-01 Thread Bryan O'Sullivan
Adam Langley wrote: The error you are seeing comes from the operating system. No, it's the Haskell runtime turning a -1 return from read into an exception. You need to call hIsEOF to check whether you've hit EOF, then break out of the loop. b

Re: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-01 Thread Dan Licata
Not to start a flame war or religious debate, but I don't think that eta-expansions should be considered bad style. I realize that composition-style is good for certain types of reasoning, but fully eta-expanded code has an important legibility advantage: you can tell the shape of its type just

Re: [Haskell-cafe] reading from the cdrom drive on Red Hat

2008-02-01 Thread Adam Langley
On Feb 1, 2008 1:42 PM, Bryan O'Sullivan [EMAIL PROTECTED] wrote: No, it's the Haskell runtime turning a -1 return from read into an exception. You need to call hIsEOF to check whether you've hit EOF, then break out of the loop. (assuming you meant 0, not -1) My bad, I thought that the

Re: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-01 Thread Lennart Augustsson
It's a matter of taste. I prefer the function composition in this case. It reads nicely as a pipeline. -- Lennart On Fri, Feb 1, 2008 at 9:48 PM, Dan Licata [EMAIL PROTECTED] wrote: Not to start a flame war or religious debate, but I don't think that eta-expansions should be considered bad

Re: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-01 Thread Derek Elkins
On Fri, 2008-02-01 at 16:48 -0500, Dan Licata wrote: Not to start a flame war or religious debate, but I don't think that eta-expansions should be considered bad style. I realize that composition-style is good for certain types of reasoning, but fully eta-expanded code has an important

Re: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-01 Thread Conor McBride
Folks On 1 Feb 2008, at 22:19, Lennart Augustsson wrote: It's a matter of taste. I prefer the function composition in this case. It reads nicely as a pipeline. -- Lennart Dan L : On Fri, Feb 1, 2008 at 9:48 PM, Dan Licata [EMAIL PROTECTED] wrote: Not to start a flame war or

[Haskell-cafe] Re: Who started 42, and when?

2008-02-01 Thread Martin Lüthi
Hi Phil Molyneux [EMAIL PROTECTED] writes: Hi --- The arbitrary constant was made popular by Douglas Adams in the mid-1970s radio series ``A Hitchhikers Guide to the Galaxy'' (a trilogy in 4 parts) --- however it does have a basis in the standard model of physics --- a paper in Phys.Rev. of

[Haskell-cafe] Issues with hsql-sqllite build; errors from the hackage download

2008-02-01 Thread bbrown
There seems to be an issue with the hsql-sqlite3. Anyone have a fix. Should I use what is from darcs? Index of /packages/archive/hsql-sqlite3/1.7/logs/failure The Glorious Glasgow Haskell Compilation System, version 6.8.1 $ runhaskell Setup.lhs configure Setup.lhs:7:33: Module

[Haskell-cafe] Re: Who started 42, and when?

2008-02-01 Thread jerzy . karczmarczuk
Martin Lüthi: In the Japanese culture the number 42 has a very special meaning. I realized that while discussing cultural differences with a Japanese. Pronouncing 42 sounds like death or to die. No hotel in Japan has a room 42. After knowing that it is hard to think that Doug Adams was not

Re: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-01 Thread Don Stewart
derek.a.elkins: On Fri, 2008-02-01 at 16:48 -0500, Dan Licata wrote: Not to start a flame war or religious debate, but I don't think that eta-expansions should be considered bad style. I realize that composition-style is good for certain types of reasoning, but fully eta-expanded code

RE: [Haskell-cafe] Haskell maximum stack depth

2008-02-01 Thread Simon Peyton-Jones
| Yes, using lots of stack is clearly bad with ghc, but this is a ghc | bug. In fact the only reason these programs do use lots of stack | (vs. heap) is just a peculiarity of ghc rts implementation, so it | really should be ghc that fixes the problem, or at least admits | responsibility :-) I

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-01 Thread Isaac Dupree
Wolfgang Jeltsch wrote: Am Freitag, 1. Februar 2008 05:11 schrieben Sie: Wolfgang Jeltsch wrote: Well, the representation (D1,D2,D9) might be considered more readable. It has the disadvantage of a fixed maximum size for the numbers. Which takes me to a point I had already considered some

[Haskell-cafe] parsec3 pre-release

2008-02-01 Thread Derek Elkins
I'm currently getting Paolo Martini's Google Summer of Code project, an updated version of Parsec, into a releasable state, and I will be maintaining it for at least a while. Paolo's major additions are: * The Parser monad has been generalized into a Parser monad transformer

[Haskell-cafe] parsec3 pre-release [important note]

2008-02-01 Thread Derek Elkins
I forgot to mention that the Text.Parsec modules should be preferred to the Text.ParserCombinators.Parsec modules as the Haddock documentation reveals. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] parsec3 pre-release [attempt 2]

2008-02-01 Thread Derek Elkins
[Now with 100% more correct darcs get URLs.] I'm currently getting Paolo Martini's Google Summer of Code project, an updated version of Parsec, into a releasable state, and I will be maintaining it for at least a while. Paolo's major additions are: * The Parser monad has been generalized

[Haskell-cafe] newbie q about types

2008-02-01 Thread Logesh Pillay
I have a list. Each component is a list with 2 whole numbers. I want to multiply the second number by the log of the first eg tail ([519432,525806]) * log (head [519432,525806]). I get the ffg error message: No instance for (Floating [t]) arising from a use of `log' at

Re: [Haskell-cafe] newbie q about types

2008-02-01 Thread Jonathan Cast
On 1 Feb 2008, at 10:30 PM, Logesh Pillay wrote: I have a list. Each component is a list with 2 whole numbers. First off, why? In Haskell (unlike dynamically typed languages like Python or Perl), if you know you always have two elements, you want a pair (519432,525806), not a list

Re: [Haskell-cafe] newbie q about types

2008-02-01 Thread Luke Palmer
Look at the type of tail: tail :: [a] - [a] That is, tail is the list of all elements *except* the head. You want last. (Barring style considerations. Usually in a situation like this you would use a list of tuples rather than a list of lists, since then you know at compile time that you have

Re[2]: [Haskell-cafe] A handy little consequence of the Cont monad

2008-02-01 Thread Bulat Ziganshin
Hello Conor, Saturday, February 2, 2008, 1:29:02 AM, you wrote: nest = ala Cont traverse id Third-order: it's a whole other order. oh! i remember faces of my friends when i showed them something like sortOn snd . zip [0..]. probably i have the same face now :))) -- Best regards, Bulat