[Haskell-cafe] problems with HDBC

2011-02-15 Thread Kurt Norwood
Hi, I am getting some very cryptic error messages while trying to compile some simple code using hdbc. I am able to run the following lines in ghci without any problems. I am using ghc 6.12.1 on Ubuntu 10.10. Thanks in advance, Kurt ## # Contents of the file ##

Re: [Haskell-cafe] Unit propagation

2011-02-15 Thread PatrickM
That look compicatedI have a couple of functions at my disposal remove :: (Eq a) )a -[a] -[a] -This function removes an item from a list. neg :: Literal-Literal -This function flips a literal (ie. from P to :P and from :P to P). falseClause :: Model - Clause - Bool -This function takes a

Re: [Haskell-cafe] rewrite rules to specialize function according to type class?

2011-02-15 Thread Max Bolingbroke
2011/2/15 Gábor Lehel illiss...@gmail.com: This is a semi-related question I've been meaning to ask at some point: I suppose this also means it's not possible to write a class, write some rules for the class, and then have the rules be applied to every instance? (I.e. you'd have to write them

Re: [Haskell-cafe] problems with HDBC

2011-02-15 Thread Mark Wright
Hi Kurt, ghc needs to link libraries to the resulting code. An easy to link to the libraries is to use the ghc --make option: ghc --make testsql.hs Thanks, Mark ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Headlines on haskell.org

2011-02-15 Thread Michael Snoyman
Hi everyone, I'm not quite sure to whom to address this, but it is with regards to the Headlines section at the bottom of haskell.org. It has not been updated for 2011 yet, which I can't imagine looks very good to new users. Is anyone interested in/able to update it? If I may be so bold, I would

Re: [Haskell-cafe] Headlines on haskell.org

2011-02-15 Thread Mihai Maruseac
On Tue, Feb 15, 2011 at 11:39 AM, Michael Snoyman mich...@snoyman.com wrote: Hi everyone, I'm not quite sure to whom to address this, but it is with regards to the Headlines section at the bottom of haskell.org. It has not been updated for 2011 yet, which I can't imagine looks very good to

Re: [Haskell-cafe] rewrite rules to specialize function according to type class?

2011-02-15 Thread Simon Peyton-Jones
What happens is this. From the (Foo Bool) instance GHC generates dFooBool :: Foo Bool dFooBool = DFoo fooBool barBool foo_barBool barBool :: Bool - Bool barBool = not Now when GHC sees bar dFooBool it rewrites it to barBool Moreover there is currently no way to say don't do

Re: [Haskell-cafe] rewrite rules to specialize function according to type class?

2011-02-15 Thread José Pedro Magalhães
Hello, 2011/2/15 Simon Peyton-Jones simo...@microsoft.com but currently any pragmas in a class decl are treated as attaching to the *default method*, not to the method selector: Thanks for this clarification, I had wondered about this for a while. I think it would also be nice to mention

Re: [Haskell-cafe] rewrite rules to specialize function according to type class?

2011-02-15 Thread Max Bolingbroke
2011/2/15 Simon Peyton-Jones simo...@microsoft.com: but currently any pragmas in a class decl are treated as attaching to the *default method*, not to the method selector: I see. I didn't realise that that was what was happening. Personally I find this a bit surprising, but I can see the

Re: [Haskell-cafe] rewrite rules to specialize function according to type class?

2011-02-15 Thread Roman Leshchinskiy
Max Bolingbroke wrote: 2011/2/15 Simon Peyton-Jones simo...@microsoft.com: but currently any pragmas in a class decl are treated as attaching to the *default method*, not to the method selector: I see. I didn't realise that that was what was happening. Personally I find this a bit

Re: [Haskell-cafe] rewrite rules to specialize function according to type class?

2011-02-15 Thread Max Bolingbroke
On 15 February 2011 11:23, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: I wouldn't necessarily expect this to guarantee inlining for the same reason that the following code doesn't guarantee that foo gets rewritten to big: foo = bar {-# INLINE bar #-} bar = big It might work with the

Re: [Haskell-cafe] Fwd: ANN: vector-buffer package 0.1

2011-02-15 Thread Markus Läll
Hi, Alexander Here's my take on why the code isnt right: In the let the v1 and v2 get lazyly bound to code that calls unsafePerformIO. unsafePerformIO does side-effectful things, but works outside the IO monad and thus outside the main order of IO actions. If you create a buffer, push something

Re: [Haskell-cafe] rewrite rules to specialize function according to type class?

2011-02-15 Thread Roman Leshchinskiy
Max Bolingbroke wrote: On 15 February 2011 11:23, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: I wouldn't necessarily expect this to guarantee inlining for the same reason that the following code doesn't guarantee that foo gets rewritten to big: foo = bar {-# INLINE bar #-} bar = big

Re: [Haskell-cafe] Headlines on haskell.org

2011-02-15 Thread Don Stewart
Just edit, its a wiki :-) michael: Hi everyone, I'm not quite sure to whom to address this, but it is with regards to the Headlines section at the bottom of haskell.org. It has not been updated for 2011 yet, which I can't imagine looks very good to new users. Is anyone interested in/able

Re: [Haskell-cafe] Headlines on haskell.org

2011-02-15 Thread Axman
Might be nice to say have stories from planet.haskell.org showing there, which much more accurately shows what's happening in the haskell world than a list updated by hand every now and then. Or maybe it could e updated with the contents of the top stories that are in the Haskell Sequence. On 16

Re: [Haskell-cafe] rewrite rules to specialize function according to type class?

2011-02-15 Thread Max Bolingbroke
On 15 February 2011 15:12, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: Ah, but you assume that bar won't be inlined into foo first. Consider that it is perfectly acceptable for GHC to generate this: foo = big {-# INLINE bar #-} bar = big We did ask to inline bar, after all. Well, yes,

Re: [Haskell-cafe] rewrite rules to specialize function according to type class?

2011-02-15 Thread Roman Leshchinskiy
Max Bolingbroke wrote: On 15 February 2011 15:12, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: Ah, but you assume that bar won't be inlined into foo first. Consider that it is perfectly acceptable for GHC to generate this: foo = big {-# INLINE bar #-} bar = big We did ask to inline bar,

Re: [Haskell-cafe] rewrite rules to specialize function according to type class?

2011-02-15 Thread Max Bolingbroke
On 15 February 2011 16:45, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: Only if foo has an INLINE pragma. Otherwise, GHC uses whatever RHS is available when it wants to inline. Ah, I see! Well yes, in that case my workaround is indeed broken in the way you describe, and there is no way to

[Haskell-cafe] On hGetContents semi-closenesscloseness

2011-02-15 Thread Rafael Cunha de Almeida
From http://www.haskell.org/ghc/docs/latest/html/libraries/base/System-IO.html: Computation hGetContents hdl returns the list of characters corresponding to the unread portion of the channel or file managed by hdl, which is put into an intermediate state,

Re: [Haskell-cafe] problems with HDBC

2011-02-15 Thread Kurt Norwood
Awesome, that works! Thanks, Kurt On Tue, Feb 15, 2011 at 1:33 AM, Mark Wright markwri...@internode.on.netwrote: Hi Kurt, ghc needs to link libraries to the resulting code. An easy to link to the libraries is to use the ghc --make option: ghc --make testsql.hs Thanks, Mark

Re: [Haskell-cafe] rewrite rules to specialize function according to type class?

2011-02-15 Thread Roman Leshchinskiy
Max Bolingbroke wrote: On 15 February 2011 16:45, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: Only if foo has an INLINE pragma. Otherwise, GHC uses whatever RHS is available when it wants to inline. Ah, I see! Well yes, in that case my workaround is indeed broken in the way you describe,

Re: [Haskell-cafe] Headlines on haskell.org

2011-02-15 Thread Antoine Latter
On Tue, Feb 15, 2011 at 10:17 AM, Axman axm...@gmail.com wrote: Might be nice to say have stories from planet.haskell.org showing there, which much more accurately shows what's happening in the haskell world than a list updated by hand every now and then. Or maybe it could e updated with the

Re: [Haskell-cafe] ANNOUNCE: hspec-0.1.0 (Behavior Driven Development for Haskell)

2011-02-15 Thread Simon Michael
On 2/11/11 8:42 PM, trysta...@comcast.net wrote: Any advice, comments, or questions are welcome. Hi Trystan.. it looks great. I like the rubyish brevity and readability. Please do publish on hackage. What should we read to find out more about this style of tests, http://rspec.info ? When

[Haskell-cafe] Haskell GUI

2011-02-15 Thread Mihai Maruseac
Hi, I'd like to start a new project in Haskell, this time using an user interface. Looking at [1] I found that there are several of them listed there. However, the list there is very long. Right now, I am unsure on what is best to use. Can someone give me any hints on which is the most

Re: [Haskell-cafe] Haskell GUI

2011-02-15 Thread Chris Smith
On Tue, 2011-02-15 at 20:20 +0200, Mihai Maruseac wrote: Right now, I am unsure on what is best to use. Can someone give me any hints on which is the most kept-to-date and most supported GUI library? It would be hard to beat Gtk2Hs if you're looking for mature, solid, up to date, and widely

[Haskell-cafe] How to use http-enumerator with hoauth?

2011-02-15 Thread Jeremy Fitzhardinge
Hi, I'm trying to use http-enumerator with Twitter's streaming API, which requires OAuth authentication. I was hoping to use the hoauth package for this, but it seems that combining with with http-enumerator is pretty awkward. In principle, it should be straightforward since hoauth defines a

[Haskell-cafe] Alex question

2011-02-15 Thread Mihai Maruseac
Hi, I want to make Alex to parse a file using states. I wrote a simple basic wrapped .x file but it complaints that it doesn't know the begin symbol. As listed here[1], my code does something like this: 0 \/{2} { begin italic } Am I doing something wrong? Should I manage myself the states?

Re: [Haskell-cafe] Haskell GUI

2011-02-15 Thread Mihai Maruseac
On Tue, Feb 15, 2011 at 8:20 PM, Mihai Maruseac mihai.marus...@gmail.com wrote: Hi, I'd like to start a new project in Haskell, this time using an user interface. Looking at [1] I found that there are several of them listed there. However, the list there is very long. Right now, I am unsure

Re: [Haskell-cafe] On hGetContents semi-closenesscloseness

2011-02-15 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 (I'm probably glossing over important stuff and getting some details wrong, as usual, but I hope it's good enough to give some idea of what's going on.) On 2/15/11 11:57 , Rafael Cunha de Almeida wrote: What state is that? It seems to be something

Re: [Haskell-cafe] Sub-optimal [code]

2011-02-15 Thread Andrew Coppin
I tried -O2 -fno-cse. No difference. I also tried -O2 -fno-full-laziness. BIG DIFFERENCE. See also the very old GHC ticket at http://hackage.haskell.org/trac/ghc/ticket/917 I don't know if that's the problem or not, but it might plausibly be. Here's the smallest version of the program that

Re: [Haskell-cafe] On hGetContents semi-closenesscloseness

2011-02-15 Thread Chris Smith
On Tue, 2011-02-15 at 14:06 -0500, Brandon S Allbery KF8NH wrote: entirely consumed that the descriptor gets closed. Is hGetContents responsible for closing the descriptor? Or is it the garbage collector? Who closes the descriptor when the contents are read? Looking at hGetContents

Re: [Haskell-cafe] Alex question

2011-02-15 Thread Mihai Maruseac
On Tue, Feb 15, 2011 at 8:47 PM, Mihai Maruseac mihai.marus...@gmail.com wrote: Hi, I want to make Alex to parse a file using states. I wrote a simple basic wrapped .x file but it complaints that it doesn't know the begin symbol. As listed here[1], my code does something like this: 0 \/{2}

Re: [Haskell-cafe] On hGetContents semi-closenesscloseness

2011-02-15 Thread Andrew Coppin
In a way, it's analogous to the situation with garbage collection and closing file handles in finalizers; but the details are different and the unpredictable file closing comes from lazy evaluation rather than garbage collection. Except that lazy evaluation can affect *when* the data becomes

Re: [Haskell-cafe] Froglingo – a functional programming language

2011-02-15 Thread kevin
Upon a few requests, a brief view about how you would do with Froglingo is given as following: With Froglingo, users' main task is to organize business data and logic in the EP data model, i.e., the way that higher-order functions are related to each others. The remaining task is to specify

Re: [Haskell-cafe] unicode filenames advice

2011-02-15 Thread Yves Parès
I noticed the same issue under ubuntu when feeding my program (i.e. on the command line) file names with special characters (my locale is fr_FR.UTF-8). I discovered I had to use Codec.Binary.String.UTF8.decodeString. I didn't know it was only for Unix. 2011/2/11 Joey Hess j...@kitenet.net I've

Re: [Haskell-cafe] Sub-optimal [code]

2011-02-15 Thread Daniel Fischer
On Tuesday 15 February 2011 20:15:54, Andrew Coppin wrote: I tried -O2 -fno-cse. No difference. I also tried -O2 -fno-full-laziness. BIG DIFFERENCE. See also the very old GHC ticket at http://hackage.haskell.org/trac/ghc/ticket/917 I don't know if that's the problem or not, but it

Re: [Haskell-cafe] Sub-optimal [code]

2011-02-15 Thread Claude Heiland-Allen
On 15/02/11 20:35, Daniel Fischer wrote: Which makes me wonder: unwanted sharing of lists [1 .. n] or similar is a frequent cause of space leaks, so would it be possible to teach GHC to not share such lists (unless they're bound to a name to indicate sharing is wanted)? In particular for

Re: [Haskell-cafe] Sub-optimal [code]

2011-02-15 Thread Daniel Fischer
On Tuesday 15 February 2011 22:20:06, Claude Heiland-Allen wrote: Compare with the heap profile graph output from this short program which uses a horrible data-dependency hack to force recomputation: main = do print $ length [(x,y) | x - [(1 :: Int) .. 1], y - [(1 :: Int) ..

Re: [Haskell-cafe] How to use http-enumerator with hoauth?

2011-02-15 Thread Vincent Hanquez
On Tue, Feb 15, 2011 at 10:42:57AM -0800, Jeremy Fitzhardinge wrote: And since I'm still trying to get my head around enumerators, I may have that aspect of things completely wrong. I haven't even tried running any of this yet, so I don't know if I've made any non-type errors. Am I even

Re: [Haskell-cafe] ANNOUNCE: hspec-0.1.0 (Behavior Driven Development for Haskell)

2011-02-15 Thread John Van Enk
I second the request to publish this to hackage. On Tue, Feb 15, 2011 at 1:02 PM, Simon Michael si...@joyful.com wrote: On 2/11/11 8:42 PM, trysta...@comcast.net wrote: Any advice, comments, or questions are welcome. Hi Trystan.. it looks great. I like the rubyish brevity and readability.

Re: [Haskell-cafe] Sub-optimal [code]

2011-02-15 Thread Andrew Coppin
On 15/02/2011 08:35 PM, Daniel Fischer wrote: The result is that the list [1 .. 10*1024*1024*k] from the penultimate line of random_file is shared between the four iterations of the inner loop in file_batch (for k = 1 .. 4). Oops. Ouch! That's gotta sting in the morning... o_O I suppose

Re: [Haskell-cafe] Sub-optimal [code]

2011-02-15 Thread Daniel Fischer
On Tuesday 15 February 2011 23:29:39, Andrew Coppin wrote: On 15/02/2011 08:35 PM, Daniel Fischer wrote: The result is that the list [1 .. 10*1024*1024*k] from the penultimate line of random_file is shared between the four iterations of the inner loop in file_batch (for k = 1 .. 4).

[Haskell-cafe] Abstracting a Genetic Algorithm

2011-02-15 Thread Alex Good
I've copied this from http://stackoverflow.com/questions/5010267/haskell-abstracting-a-genetic-algorithm as someone suggested that it might spark an interesting discussion I'm new to the world of Haskell programming and I'm cutting my teeth on a simple genetic algorithm for finding good

Re: [Haskell-cafe] Unit propagation

2011-02-15 Thread PatrickM
any other advice? -- View this message in context: http://haskell.1045720.n5.nabble.com/Unit-propagation-tp3384635p3386915.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] How to use http-enumerator with hoauth?

2011-02-15 Thread Jeremy Fitzhardinge
On 02/15/2011 02:14 PM, Vincent Hanquez wrote: Clearly, http-enumerator is the best package for doing http/https. however since it's pretty new, lots of package still uses their own abstraction for doing things. While it may be possible to retrofit hoauth to use http-enumerator, using the

Re: [Haskell-cafe] Abstracting a Genetic Algorithm

2011-02-15 Thread Rogan Creswick
On Tue, Feb 15, 2011 at 3:35 PM, Alex Good alexjsg...@gmail.com wrote: One bonus question, just a thing that's been bothering me, is there any way to create something like a type synonym for a function so that if I'm writing a function which takes functions as arguments I can write the

Re: [Haskell-cafe] Byte Histogram

2011-02-15 Thread Scott Turner
On 2011-02-11 02:06, wren ng thornton wrote: And it is clear that pointed and unpointed versions are different types[1]. ... [1] Though conversion between them is easy. From unpointed to pointed is just a forgetful functor; from pointed to unpointed is the monad of evaluation. I'm unskilled

Re: [Haskell-cafe] How to use http-enumerator with hoauth?

2011-02-15 Thread Diego Souza
Hi, thanks for the feedbacks. They sound very reasonable. Going back in time, the first version was in fact a pure library. However, at some point I changed this as I thought it would make it easier to use, which might have been a mistake of mine. Back then http-enumerator wasn't available and

Re: [Haskell-cafe] Status update on {code, trac, projects, planet, community}.haskell.org

2011-02-15 Thread Duncan Coutts
On Wed, 2011-02-02 at 01:33 +, Duncan Coutts wrote: All, As you will be aware, some of the *.haskell.org websites have been down recently, specifically: code.haskell.org trac.haskell.org projects.haskell.org planet.haskell.org community.haskell.org [...] We have not yet

[Haskell-cafe] upgrading mtl1 to mtl2

2011-02-15 Thread Evan Laforge
I just got started on this because packages are starting to use mtl2. I had hoped it would be simple, and hopefully it is, but... Do I really have to add (Functor m) to the 300 or so functions with (Monad m) on them? Or just not use fmap or applicative? Ow. Not what I would call small

Re: [Haskell-cafe] upgrading mtl1 to mtl2

2011-02-15 Thread Ivan Lazar Miljenovic
On 16 February 2011 14:46, Evan Laforge qdun...@gmail.com wrote: I just got started on this because packages are starting to use mtl2. I had hoped it would be simple, and hopefully it is, but... Do I really have to add (Functor m) to the 300 or so functions with (Monad m) on them?  Or just

Re: [Haskell-cafe] How to use http-enumerator with hoauth?

2011-02-15 Thread Michael Snoyman
On Wed, Feb 16, 2011 at 2:05 AM, Jeremy Fitzhardinge jer...@goop.org wrote: On 02/15/2011 02:14 PM, Vincent Hanquez wrote: Clearly, http-enumerator is the best package for doing http/https. however since it's pretty new, lots of package still uses their own abstraction for doing things.

Re: [Haskell-cafe] upgrading mtl1 to mtl2

2011-02-15 Thread Evan Laforge
On Tue, Feb 15, 2011 at 7:58 PM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 16 February 2011 14:46, Evan Laforge qdun...@gmail.com wrote: I just got started on this because packages are starting to use mtl2. I had hoped it would be simple, and hopefully it is, but... Do I

Re: [Haskell-cafe] How to use http-enumerator with hoauth?

2011-02-15 Thread Jeremy Fitzhardinge
On 02/15/2011 05:49 PM, Diego Souza wrote: Hi, thanks for the feedbacks. They sound very reasonable. Going back in time, the first version was in fact a pure library. However, at some point I changed this as I thought it would make it easier to use, which might have been a mistake of mine.

Re: [Haskell-cafe] How to use http-enumerator with hoauth?

2011-02-15 Thread Jeremy Fitzhardinge
On 02/15/2011 08:02 PM, Michael Snoyman wrote: On Wed, Feb 16, 2011 at 2:05 AM, Jeremy Fitzhardinge jer...@goop.org wrote: On 02/15/2011 02:14 PM, Vincent Hanquez wrote: Clearly, http-enumerator is the best package for doing http/https. however since it's pretty new, lots of package still uses