Re: [Haskell-cafe] Please report any bug of gtk2hs-0.11.0!

2010-07-19 Thread Felipe Lessa
Err... where is pixbufFromImageSurface [1] now? I have an old program that draws using cairo an static diagram to a pixbuf which then becomes the backend of an Image. If pixbufFromImageSurface got deprecated, what's a better solution? [1]

Re: [Haskell-cafe] Running tests in Cabal

2010-07-19 Thread Johan Tibell
On Sun, Jul 18, 2010 at 9:23 PM, Magnus Therning mag...@therning.orgwrote: In my Cabal file I have defined a flag that controls whether tests are built or not. Now I'd like to hook it up a bit more so that './Setup.hs test' actually runs the tests. I haven't found a way to access that

Re: [Haskell-cafe] Running tests in Cabal

2010-07-19 Thread Magnus Therning
On 19/07/10 07:14, Johan Tibell wrote: On Sun, Jul 18, 2010 at 9:23 PM, Magnus Therning mag...@therning.orgwrote: In my Cabal file I have defined a flag that controls whether tests are built or not. Now I'd like to hook it up a bit more so that './Setup.hs test' actually runs the tests. I

Re: [Haskell-cafe] [Newbie] What to improve in my code

2010-07-19 Thread Ketil Malde
Daniel Fischer daniel.is.fisc...@web.de writes: First of all: I'm not sure if this question is allowed here. If not, I apologize You might want to check out the haskell-beginners list, but IMO most questions are okay to post here. Just a couple of style issues Daniel didn't mention: process

Re: [Haskell-cafe] How do you make constant expressions?

2010-07-19 Thread Eitan Goldshtrom
One point of clarification that'd be nice. I'm getting some type errors that I wasn't getting before, so I'd just like to know something about the inline pragma. I have width = 800 {-# INLINE width #-} main = (truncate width, fromIntegral width) Now when I ran this program it seemed to work

Re: [Haskell-cafe] How do you make constant expressions?

2010-07-19 Thread Eitan Goldshtrom
Correction to my last e-mail. I figured out why it worked at first and then failed, so I'll refine my question. I'd like the compiler to simply put the number 800 everywhere that I put the name width in my code. Instead it's putting (800 :: Float), or Double or Int, whatever I want, but it's

Re: [Haskell-cafe] A question about State Monad and Monad in general

2010-07-19 Thread Ketil Malde
C K Kashyap ckkash...@gmail.com writes: I looked at State Monad yesterday and this question popped into my mind. From what I gather State Monad essentially allows the use of Haskell's do notation to invisibly pass around a state. So, does the use of Monadic style fetch us more than syntactic

Re: [Haskell-cafe] [Newbie] What to improve in my code

2010-07-19 Thread David Virebayre
On Tue, Jul 13, 2010 at 11:49 PM, Frank1981 frankdewe...@gmail.com wrote: First of all: I'm not sure if this question is allowed here. If not, I apologize I'm trying to solve the following problem: For each word in a text find the number of occurences for each unique word in the text. i've

Re: [Haskell-cafe] How do you make constant expressions?

2010-07-19 Thread Ivan Lazar Miljenovic
Eitan Goldshtrom thesource...@gmail.com writes: Correction to my last e-mail. I figured out why it worked at first and then failed, so I'll refine my question. I'd like the compiler to simply put the number 800 everywhere that I put the name width in my code. Instead it's putting (800 ::

Re: [Haskell-cafe] How do you make constant expressions?

2010-07-19 Thread Max Bolingbroke
Use NoMonomorphismRestriction or give an explicit type signature: width :: Num a = a width = 800 Max On 19 July 2010 09:17, Eitan Goldshtrom thesource...@gmail.com wrote: Correction to my last e-mail. I figured out why it worked at first and then failed, so I'll refine my question. I'd like

Re: [Haskell-cafe] A question about State Monad and Monad in general

2010-07-19 Thread C K Kashyap
Okay...I think I am beginning to understand. Is it right to assume that magic is backed by FFI and cannot be done in pure Haskell? On Mon, Jul 19, 2010 at 1:47 PM, Ketil Malde ke...@malde.org wrote: C K Kashyap ckkash...@gmail.com writes: I looked at State Monad yesterday and this question

Re: [Haskell-cafe] A question about State Monad and Monad in general

2010-07-19 Thread C K Kashyap
Also, Claude ... If I am correct, in your example, there is no in-place replacement happening. On Mon, Jul 19, 2010 at 2:36 PM, C K Kashyap ckkash...@gmail.com wrote: Okay...I think I am beginning to understand. Is it right to assume that magic is backed by FFI and cannot be done in pure

Re: [Haskell-cafe] A question about State Monad and Monad in general

2010-07-19 Thread Max Rabkin
On Mon, Jul 19, 2010 at 10:17 AM, Ketil Malde ke...@malde.org wrote: At it's heart, monads are just syntactic convenience, but like many other syntactic conveniences, allows you to structure your code better. Thus it's more about programmer efficiency than program efficiency. (The do notation

Re: [Haskell-cafe] [Newbie] What to improve in my code

2010-07-19 Thread Dougal Stanton
On Mon, Jul 19, 2010 at 9:24 AM, David Virebayre dav.vire+hask...@gmail.com wrote: A minor point: instead of removing the punctuation, you maybe should convert it to whitespace. Otherwise in texts like there was a quick,brown fox (notice the missing space after the comma) you'll have the

[Haskell-cafe] qtHaskell

2010-07-19 Thread Ali Razavi
Greetings, I have only used the wxHaskell library before, but I am looking into trying one of these more 'advanced' frameworks. To serve my proclivity for QT, I would like to know how its Haskell binding, qtHaskell, compares to that of Gtk. Regards, Ali Razavi

Re: [Haskell-cafe] possible bug in default module lookup scheme / or invalid haskell?

2010-07-19 Thread Kevin Quick
On Sun, 18 Jul 2010 12:02:39 -0700, Carter Schonwald carter.schonw...@gmail.com wrote: nope, I was suggesting rather: ./A.hs has module A which has an import A.B line ./A/ has B.hs with module A.B which imports A.B.C /C which has module A.B.C in file C.hs I think this scenario should work

[Haskell-cafe] cabal, Setup.lhs example

2010-07-19 Thread Tom Hawkins
I have a script I'm using to generate some Haskell code for a library. How do I specify this flow in the cabal setup file? Would someone point me to a relevant library I can reference as an example? -Tom ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] MonadLib usage

2010-07-19 Thread Ben Millwood
On Sun, Jul 18, 2010 at 5:59 PM, Emil Melnikov emilm...@gmail.com wrote: On 2010, July 18, 23:27 Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: When discussing a similar issue with Manuel Chakravarty, he convinced me that cunning newtype deriving is actually rather bad in practice and

Re: [Haskell-cafe] A question about State Monad and Monad in general

2010-07-19 Thread aditya siram
Do you want a solution like this? import Data.IORef replace :: Int - [IORef (Int,Int,Int)] - (Int,Int,Int) - IO () replace index pixels new_val = do old_val - return $ pixels !! index writeIORef old_val new_val print_pixels = mapM (\p - readIORef p = print) test_data :: [(Int,Int,Int)]

[Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-19 Thread José Romildo Malaquias
Hello. In his book Modern Compilder Implementation in ML, Appel presents a compiler project for the Tiger programming language where type checking and intermediate code generation are intrinsically coupled. There is a function transExp :: Absyn.Exp - (Tree.Exp,Types.Type) that do semantic

Re: [Haskell-cafe] cabal, Setup.lhs example

2010-07-19 Thread Stephen Tetley
Hi Tom This will the job for a UserHooks - probably preBuild? - see Distribution.Simple.UserHooks. postConf - Hook to run after configure command preBuild - Hook to run before build command. Second arg indicates verbosity level. buildHook - Over-ride this hook to get different behaviour during

[Haskell-cafe] Database.CouchDB broken?

2010-07-19 Thread Moritz Ulrich
Hello, I'm currently learning Haskell and I want to write a small tool to collect some data in a CouchDB-Database Sadly, the Database.CouchDB module from hackage (and from git) seems broken. It looks like a bug deep in the JSON handling of the lib. Some examples can be found in this gist:

Re: [Haskell-cafe] A question about State Monad and Monad in general

2010-07-19 Thread aditya siram
Sorry, the previous code does not compile. It should be: replace :: Int - [IORef (Int,Int,Int)] - (Int,Int,Int) - IO () replace index pixels new_val = do old_val - return $ pixels !! index writeIORef old_val new_val print_pixels = mapM_ (\p - readIORef p = print) test_data :: [(Int,Int,Int)]

Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-19 Thread Job Vranish
Martijn van Steenbergen has a good blog post that describes the method I generally use: http://martijn.van.steenbergen.nl/journal/2010/06/24/generically-adding-position-information-to-a-datatype/ In his example he annotates the expression tree with position information, but you can use the same

Re: [Haskell-cafe] qtHaskell

2010-07-19 Thread Job Vranish
I haven't used the Gtk bindings much, but the qtHaskell bindings work quite well. If you've used Qt before, it should be pretty easy to pick up. - Job On Mon, Jul 19, 2010 at 10:19 AM, Ali Razavi ali.raz...@gmail.com wrote: Greetings, I have only used the wxHaskell library before, but I am

[Haskell-cafe] Re: qtHaskell

2010-07-19 Thread Andy Stewart
Hi Ali, Ali Razavi ali.raz...@gmail.com writes: Greetings,  I have only used the wxHaskell library before, but I am looking into trying one of these more advanced' frameworks. To serve my proclivity for QT, I would like to know how its Haskell binding, qtHaskell, compares to that of

Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-19 Thread Malcolm Wallace
I would be inclined to add type annotations as an extra constructor of the expression representation type. data Exp = IntExp Integer | VarExp Symbol | AssignExp Symbol Exp | IfExp Exp Exp (Maybe Exp) | CallExp Symbol [Exp] | LetExp [Dec] Exp | Exp `HasType` Ty This

Re: [Haskell-cafe] How do you make constant expressions?

2010-07-19 Thread Eitan Goldshtrom
Awesome. It worked. Haskell continues to impress me. Thanks for the help everyone. -Eitan On 7/19/2010 4:42 AM, Max Bolingbroke wrote: Use NoMonomorphismRestriction or give an explicit type signature: width :: Num a = a width = 800 Max ___

[romi...@malaquias.dhcp-geral: Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree]

2010-07-19 Thread José Romildo Malaquias
Forgot the attachment. Romildo ---BeginMessage--- On Mon, Jul 19, 2010 at 01:51:57PM -0400, Job Vranish wrote: Martijn van Steenbergen has a good blog post that describes the method I generally use:

[Haskell-cafe] Re: Design for 2010.2.x series Haskell Platform site (Don Stewart)

2010-07-19 Thread wren ng thornton
Niemeijer, R.A. wrote: Is it just me, or does aligning [OSX,Win,Linux] `zip` [Comprehensive, Robust, CuttingEdge] send the wrong message... Yeah, I noticed that too when designing it, but at the time it didn't bother me too much. I know folks who'd refute all three of those associations,

Re: [Haskell-cafe] Design for 2010.2.x series Haskell Platform site

2010-07-19 Thread wren ng thornton
Malcolm Wallace wrote: I still like the original design on http://imgur.com/NjiVh a lot better, It has a simple modern design to it in my opinion :) +1. It is simply beautiful. Much more striking and memorable than the blue diver. I really like the background image; it's nicely striking

Re: [Haskell-cafe] Talking to Java from Haskell?

2010-07-19 Thread Travis Brady
Someone has written a large Java library (QuickFIX/J) which speaks a gnarled, ugly protocol (FIX). They've also written a large C++ library for the same purpose called QuickFix[1]. You could try wrapping it directly via the Haskell FFI. Travis [1] http://www.quickfixengine.org/ On Thu,

Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-19 Thread Job Vranish
Ah, I found the attachment on your other email. I would recommend using the Fix and Ann types, instead of the AnnFix type. I modified your code a bit (and fixed the Show instances etc...) and put it here: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=27823#a27823 Let me know if you have

Re: [Haskell-cafe] Talking to Java from Haskell?

2010-07-19 Thread Max Cantor
I use Apache Thrift, as someone else mentioned for IPC with some java code that connects to a third party data vendor. As of version 0.2, there are some bugs that you need to be aware of. However, and possibly more of interest to you, I have already written a FIX implementation in pure

[Haskell-cafe] Problem with reloading modules in GHC API

2010-07-19 Thread Hongmin Fan
Hi, I'm using GHC API to dynamically load some module, and evaluate it; and later change the content of the module, and re-evaluate it. But I found unless I delete the object file created by previous compilation, the module seems not reloaded. I have set ghcLink = LinkInMemory as an older post

[Haskell-cafe] Re: Problem with reloading modules in GHC API

2010-07-19 Thread Andy Stewart
Hi Hongmin, I think you're looking for how to hot-swap Haskell program. There are two approach to reach target: 1) Source-Code level: Recompile source code to build new execute cache file, if re-compile successful, use executeFile to switch new entry. You perhaps need use Binary