[Haskell-cafe] Multiple DB drivers in HDBC

2007-05-20 Thread kpierre
Hello. I have a problem with migration to HDBC 1.1. My application had transparent support for multiple database types, because of HDBC's Connection object. How can I preserve this feature with minimal code changes? I tried to use ConnWrapper, as migration guide suggest, but it seems there's no

[Haskell-cafe] how can I select all the 3-element-combination out of a list efficiently

2007-05-20 Thread geniusfat
hi dear haskell lover ;) what I want to do is simply this: select3 :: [a] - [(a, a, a)] and how can it be done efficiently? thanks in advance! -- View this message in context: http://www.nabble.com/how-can-I-select-all-the-3-element-combination-out-of-a-list-efficiently-tf3776055.html#a10677373

Re: [Haskell-cafe] how can I select all the 3-element-combination out of a list efficiently

2007-05-20 Thread Andrew Coppin
geniusfat wrote: hi dear haskell lover ;) what I want to do is simply this: select3 :: [a] - [(a, a, a)] and how can it be done efficiently? thanks in advance! What, as in select3 [1..10] - [(1,2,3),(2,3,4),(3,4,5),(4,5,6),(5,6,7),(6,7,8),(7,8,9),(8,9,10)] ? How about like this:

Re: [Haskell-cafe] How do I insert an element in HaXml?

2007-05-20 Thread Malcolm Wallace
Jeremy Shaw [EMAIL PROTECTED] writes: How do I create a HaXml filter that adds a new element as a child of an existing element. For example, let's say I have the XML document: a b/ c/ /a How do I add a new element under a / so that I have the document: a newElement/ b/ c/ /a Using

Re: [Haskell-cafe] Profiling, measuring time

2007-05-20 Thread Steffen Mazanek
Thats it! Thanks a lot. I do not even need forceOutput, because I perform a bottom-up analysis. And the timeline I got looks sooo great (perfect polynomial behavior :-)) Best regards, Steffen 2007/5/20, Matthew Brecknell [EMAIL PROTECTED]: Steffen Mazanek: I have written a function f, that

[Haskell-cafe] Random idea

2007-05-20 Thread Andrew Coppin
Greetings. I was thinking... we already have Lambdabot sitting in an IRC channel. How hard would it be to mangle Lambdabot to the point where it works over HTTP? You know - so you could type some Haskell into a form on a web page, hit [submit], and get the result sent back to you? (Again,

Re: [Haskell-cafe] Random idea

2007-05-20 Thread Rodrigo Queiro
http://lambdabot.codersbase.com/ Still, an interface like the fancy Web 2.0 ones that Ruby has could be nice. On 20/05/07, Andrew Coppin [EMAIL PROTECTED] wrote: Greetings. I was thinking... we already have Lambdabot sitting in an IRC channel. How hard would it be to mangle Lambdabot to the

Re: [Haskell-cafe] Random idea

2007-05-20 Thread Donald Bruce Stewart
andrewcoppin: Greetings. I was thinking... we already have Lambdabot sitting in an IRC channel. How hard would it be to mangle Lambdabot to the point where it works over HTTP? You know - so you could type some Haskell into a form on a Lambdabot web server is here:

Re: [Haskell-cafe] how can I select all the 3-element-combination out of a list efficiently

2007-05-20 Thread Jules Bean
geniusfat wrote: hi dear haskell lover ;) what I want to do is simply this: select3 :: [a] - [(a, a, a)] and how can it be done efficiently? thanks in advance! If, given [1,2,3,4,5,6,7,8,9,10,11,12] you want [(1,2,3),(4,5,6),(7,8,9)] then: map (take 3) . iterate (drop 3) is very

Re: [Haskell-cafe] Random idea

2007-05-20 Thread Andrew Coppin
Rodrigo Queiro wrote: http://lambdabot.codersbase.com/ OMG! That was really fast... o_O Still, an interface like the fancy Web 2.0 ones that Ruby has could be nice. I have no idea what Web 2.0 is, but from what I hear it's overrated... Well, a web interface potentially provides for nicer

Re: [Haskell-cafe] Random idea

2007-05-20 Thread Andrew Coppin
Rodrigo Queiro wrote: http://lambdabot.codersbase.com/ Wait, what the hell...? 1 + 1 /usr/lib/ghc-6.4.2/package.conf: openFile: does not exist (No such file or directory) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Random idea

2007-05-20 Thread Philipp Volgger
For me it gives: 1 + 1 Maybe you meant: . v But the rest of the commands seems working ;) Andrew Coppin schrieb: Rodrigo Queiro wrote: http://lambdabot.codersbase.com/ Wait, what the hell...? 1 + 1 /usr/lib/ghc-6.4.2/package.conf: openFile: does not exist (No such file or directory)

Re: [Haskell-cafe] how can I select all the 3-element-combination out of a list efficiently

2007-05-20 Thread Jules Bean
geniusfat wrote: hi dear haskell lover ;) what I want to do is simply this: select3 :: [a] - [(a, a, a)] and how can it be done efficiently? thanks in advance! Oh, hang on. I just read your subject line. Do you really mean all the 3-elem combinations? that's much easier: Prelude let l =

Re: [Haskell-cafe] how can I select all the 3-element-combination out of a list efficiently

2007-05-20 Thread Andrew Coppin
Oh, hang on. I just read your subject line. Do you really mean all the 3-elem combinations? Ah, Haskell... So many ways to do the same thing, so many possible meanings to every apparently innocuous statement. ;-) ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] global variables

2007-05-20 Thread Adrian Hey
Jules Bean wrote: I've pretty much convinced it's wrong. There should be one and only one main from which all subsequent IO activity derives. But creating internal state in the form of mutable data structures is not an IO activity. It just so happens that at the moment the only way to do this is

Re: [Haskell-cafe] global variables

2007-05-20 Thread Jules Bean
Adrian Hey wrote: Jules Bean wrote: I've pretty much convinced it's wrong. There should be one and only one main from which all subsequent IO activity derives. But creating internal state in the form of mutable data structures is not an IO activity. It just so happens that at the moment the

Re: [Haskell-cafe] global variables

2007-05-20 Thread Adrian Hey
[cc'ing HPrime] Isaac Dupree wrote: The unsafePerformIO hack being used is not very satisfactory given how many optimizations make it difficult to use safely in practice. This hack is also used many places. I would be happier if that situation were not true, and I suspect there's something

Re: [Haskell-cafe] global variables

2007-05-20 Thread Isaac Dupree
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Adrian Hey wrote: [cc'ing HPrime] Isaac Dupree wrote: The unsafePerformIO hack being used is not very satisfactory given how many optimizations make it difficult to use safely in practice. This hack is also used many places. I would be

[Haskell-cafe] Profiling, GUIs and libraries

2007-05-20 Thread Anthony Chaumas-Pellet
Hello, I'm currently hacking away a wxhaskell program that uses up 100% CPU even when it should be idle. So, rather than doing blind guesswork, I've thought about using profiling to spot the zealous function. I do not need a very accurate result, though. ghc with -prof -auto(-all) produces the

[Haskell-cafe] Re: Debunking tail recursion

2007-05-20 Thread Jon Fairbairn
Ilya Tsindlekht [EMAIL PROTECTED] writes: On Sat, May 19, 2007 at 09:16:46PM +0100, Jon Fairbairn wrote: Ilya Tsindlekht [EMAIL PROTECTED] writes: By definition, tail recursive function is recursive function in which the value returned from a recursive call is immediately returned

Re: [Haskell-cafe] global variables

2007-05-20 Thread Adrian Hey
Isaac Dupree 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... if successful it would remove the occasional need for -fno-cse for a whole module in GHC, at least. I have a hard

Re: [Haskell-cafe] Random idea

2007-05-20 Thread Jason Dagit
On 5/20/07, Andrew Coppin [EMAIL PROTECTED] wrote: Rodrigo Queiro wrote: http://lambdabot.codersbase.com/ Wait, what the hell...? 1 + 1 /usr/lib/ghc-6.4.2/package.conf: openFile: does not exist (No such file or directory) Sorry about that, I upgraded my ghc package without realizing it

Re: [Haskell-cafe] global variables

2007-05-20 Thread Albert Y. C. Lai
Adrian Hey wrote: Also, I don't know if the OP was a noob, but telling people (especially noobs) that if they can't figure out how to solve a problem without using a global variable then that must be down to inexperience and general cluelessness on their part just seems wrong to me. It simply

Re: [Haskell-cafe] global variables

2007-05-20 Thread Adrian Hey
Jules Bean wrote: That's not my point. newIORef creates unique names (references). The whole job of newIORef is to create unique names; unique names which refer to little tiny bits of state parcelled up somewhere in that mysterious IO monad. It is the scope of this uniqueness I'm talking

Re: [Haskell-cafe] global variables

2007-05-20 Thread Adrian Hey
Albert Y. C. Lai wrote: Adrian Hey wrote: Also, I don't know if the OP was a noob, but telling people (especially noobs) that if they can't figure out how to solve a problem without using a global variable then that must be down to inexperience and general cluelessness on their part just seems

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

[Haskell-cafe] HaskellWiki XHTML not well-formed or valid

2007-05-20 Thread Isaac Dupree
I mentioned this a few months ago in a place no-one noticed, it seems... http://www.haskell.org/haskellwiki/Talk:Haskell#Well-formedness_.2F_validity Please fix, or tell me who to contact (and how), or how to fix it myself? :-) Isaac ___ Haskell-Cafe

Re: [Haskell-cafe] writer monad help

2007-05-20 Thread Andrea Vezzosi
if by figure out you meant to do what tell does without using it, you should have written: foo = Writer ((),hello) that would have had the right type, using return you are doing something different. in the Writer monad return :: Monoid w = a - Writer w a so return ((),hello) :: Monoid w = Writer

[Haskell-cafe] Haskell: the Craft of Functional Programming

2007-05-20 Thread PR Stanley
Hi I've acquired a copy of the above title but it requires a lot of transcription work. So, I thought I'd first ensure it's worth the time and effort. This edition was published in 1999. All Opinions on the text, good or bad, would be very welcome. Thanks, Paul

Re: [Haskell-cafe] Haskell: the Craft of Functional Programming

2007-05-20 Thread Michael Vanier
I'm not sure what you mean by a lot of transcription work. It's an excellent book, aimed at beginners. Mike PR Stanley wrote: Hi I've acquired a copy of the above title but it requires a lot of transcription work. So, I thought I'd first ensure it's worth the time and effort. This edition

Re: [Haskell-cafe] how can I select all the 3-element-combination out of a list efficiently

2007-05-20 Thread Marc A. Ziegert
with which model in Combinatorics in mind do you want that function? with or without repetition? http://en.wikipedia.org/wiki/Combinatorics#Permutation_with_repetitionthe order matters and each object can be chosen more than once

Re: [Haskell-cafe] Haskell: the Craft of Functional Programming

2007-05-20 Thread Marc A. Ziegert
i don't know where my copy is or who it has, for years. but i remember one bad thing... either i missread the following (my english was not that good) or it is a bug in the book: (in the first chapter, i guess) if you have the function sqr x = x*x then haskell does reduce the term sqr (1+2)