Re: Re[Haskell-cafe] [2]: Reduction Sequence of simple Fibonacci sequence implementation

2009-08-31 Thread wren ng thornton
staafmeister wrote: The overhead is a O(1) overhead for the function because it needs to check if a computation has already performed. And the space overhead is not so big because every data object in memory there are a couple of references to be stored in lookup tables. So although there is

Re: [Haskell-cafe] Data.Time is so weak ?!

2009-08-31 Thread Colin Adams
How about: import Data.Time.Calendar import Data.Time.Calendar.WeekDate main = do let (y, w, d) = toWeekDate $ addDays 150 (fromGregorian 2009 8 31) putStrLn $ show d 2009/8/31 zaxis z_a...@163.com: addDays 150 (fromGregorian 2009 8 31) will work. However, how can i get its weekday from

Re: Re[Haskell-cafe] [2]: Re[2]: Re[2]: Reduction Sequence of simple Fibonacci sequence implementation

2009-08-31 Thread wren ng thornton
Luke Palmer wrote: On Fri, Aug 28, 2009 at 6:04 AM, Bulat Ziganshin wrote: it looks like cache of values computed since the last GC, because on GC all those intermediate results will be collected. i think it's not very useful outside of fib example that does exact that - reusing recently

Re: [Haskell-cafe] Data.Time is so weak ?!

2009-08-31 Thread Colin Adams
How about: import Data.Time.Calendar import Data.Time.Calendar.WeekDate main = do let (y, w, d) = toWeekDate $ addDays 150 (fromGregorian 2009 8 31) putStrLn $ show d 2009/8/31 zaxis z_a...@163.com: addDays 150 (fromGregorian 2009 8 31) will work. However, how can i get its weekday from

Re: [Haskell-cafe] happstack-helpers fails to install on Mac OSX

2009-08-31 Thread Colin Paul Adams
Colin == Colin Paul Adams co...@colina.demon.co.uk writes: Colin I've just installed the Haskell Platform (2009.2.0.2) on Colin Mac OSX 10.5.6, including GHC 6.10.4. Colin Then I started added some packahges with cabal install. Colin But happstack-helpers-0.30 fails with:

Re: [Haskell-cafe] Data.Time is so weak ?!

2009-08-31 Thread zaxis
toWeekDate meets my need, thank you! Colin Adams-3 wrote: How about: import Data.Time.Calendar import Data.Time.Calendar.WeekDate main = do let (y, w, d) = toWeekDate $ addDays 150 (fromGregorian 2009 8 31) putStrLn $ show d 2009/8/31 zaxis z_a...@163.com: addDays 150

Re: [Haskell-cafe] happstack-helpers fails to install on Mac OSX

2009-08-31 Thread Colin Paul Adams
Colin == Colin Paul Adams co...@colina.demon.co.uk writes: Colin == Colin Paul Adams co...@colina.demon.co.uk writes: Colin I've just installed the Haskell Platform (2009.2.0.2) on Colin Mac OSX 10.5.6, including GHC 6.10.4. Colin Then I started added some packahges with cabal

Re: [Haskell-cafe] Slow IO?

2009-08-31 Thread Jason Dusek
2009/08/30 Eugene Kirpichov ekirpic...@gmail.com: Here's my version that works in 0.7s for me for a file with 10^7 9's but for some reason gets a 'wrong answer' at SPOJ :) Maybe it gets a wrong answer because it reads all the input, regardless of `n`. -- Jason Dusek

Re: [Haskell-cafe] Takusen - is anyone currently using it on Win32 - ODBC?

2009-08-31 Thread Günther Schmidt
Hi Alistair, I'm using Takusen to read in static data from an SQLite database and that works just fine. My app then needs to read in dynamic data, a set of 4 CSV files, and I had been using Microsofts ODBC driver with HDBC.ODBC and that worked too. When I try to swap it for Takusen though

[Haskell-cafe] specialised monad transformers

2009-08-31 Thread Alberto G. Corona
Hi all I want to define a partial monad transformer i.e not defined for all kinds of data but the ones that have instances of certain classes. That is because in my lift instance code there are some hidden use of these classes. But because in the MonadTrans definition does not refers to the

[Haskell-cafe] Re: Snow Leopard Breaks GHC

2009-08-31 Thread Christian Maeder
Dmitri Sosnik wrote: How I can tell gcc to generate 32 bit code? I've tried to set CFLAGS=-m32, but it doesn't work. (Flags do not work -- without Makefile) Pass -optc-m32 -opta-m32 -optl-m32 through ghc (as pointed out before) for gcc, the assembler as and the linker ld resp. (I think, gcc

[Haskell-cafe] Get data from HTML pages

2009-08-31 Thread José Romildo Malaquias
Hello. I am porting to Haskell a Java application I have written to manage collections of movies. Currently the application has an option to indirectly import movie data from web pages. For that first the user should access the page in a web browser. Then the user should copy the rendered text

[Haskell-cafe] Re: How to use dyre relaunch/restore State of Gtk2hs Object?

2009-08-31 Thread Will Donnelly
Hi Andy, Your program didn't compile as given, so I cut out some of the event handling fanciness you were doing. Also, my modified version restarts whenever the 'r' key is pressed. I figure those changes aren't important to the problem at hand. Anyway, I don't think it's ever going to be possible

[Haskell-cafe] Edinburgh Hackathon round-up

2009-08-31 Thread Dougal Stanton
Hello Haskellers, On Saturday Sunday (28th 29th August) we held a Hackathon in Edinburgh, before the ICFP got fully underway. If you were there, thank you for coming. We'll be writing a summary of what happened soon, and we'd love to hear what you did. If you started a new project or fixed

[Haskell-cafe] Re: How to use dyre relaunch/restore State of Gtk2hs Object?

2009-08-31 Thread Andy Stewart
Will Donnelly will.donne...@gmail.com writes: HI Will, First, thanks for your detail explain. Hi Andy, Your program didn't compile as given, so I cut out some of the event handling fanciness you were doing. Also, my modified version restarts whenever the 'r' key is pressed. I figure those

[Haskell-cafe] Re: Snow Leopard Breaks GHC

2009-08-31 Thread David Leimbach
That works here just fine. Thanks! On Mon, Aug 31, 2009 at 4:02 AM, Christian Maeder christian.mae...@dfki.dewrote: Dmitri Sosnik wrote: How I can tell gcc to generate 32 bit code? I've tried to set CFLAGS=-m32, but it doesn't work. (Flags do not work -- without Makefile) Pass

Re: [Haskell-cafe] Get data from HTML pages

2009-08-31 Thread Martin Huschenbett
Hello José, I've done a similar task some weeks ago and I used the Haskell XML Toolbox (hxt) [1] to do this. After learning how to program with arrows it was quite easy to write arrows that extract the relevant information from XML data. Regards, Martin. [1]

Re: [Haskell-cafe] Get data from HTML pages

2009-08-31 Thread Jochem Berndsen
José Romildo Malaquias wrote: Currently the application has an option to indirectly import movie data from web pages. For that first the user should access the page in a web browser. Then the user should copy the rendered text in the web browser into an import window in my application and

Re: [Haskell-cafe] Takusen - is anyone currently using it on Win32 - ODBC?

2009-08-31 Thread Anton van Straaten
Günther Schmidt wrote: My app then needs to read in dynamic data, a set of 4 CSV files, and I had been using Microsofts ODBC driver with HDBC.ODBC and that worked too. When I try to swap it for Takusen though I get an *** Exception: DBError (HY,C00) 106 [Microsoft][ODBC Text Driver]

Re: [Haskell-cafe] Slow IO?

2009-08-31 Thread Steve
On Sun, 2009-08-30 at 18:50 +0400, Eugene Kirpichov wrote: Thanks :) I wonder why SPOJ didn't accept the same thing from me. I think that in order to obtain even higher performance we need to resort to low-level IO: raw reading into a byte buffer and parsing the very buffer to avoid

Re: [Haskell-cafe] Re: cabal: : openFile: does not exist (No such file or directory)

2009-08-31 Thread Fernando Henrique Sanches
Sorry for ressurecting the thread, my I'm having the same problem here. Deleting the .cabal/config file shows only temporary results, and -v3 isn't helping: ~/sources/haskell-platform-2009.2.0.2 % cabal update Config file /home/fernando/.cabal/config not found. Writing default configuration to

Re: [Haskell-cafe] Takusen - is anyone currently using it on Win32 - ODBC?

2009-08-31 Thread Günther Schmidt
Hi Anton, well the problem isn't really accessing the data as such, it's quite easy to use HDBC.ODBC for instance to read in the data in a very comfortable way. I was explicitly asking for Takusen because it make certain guarantees regarding resources, memory consumption and such. One

[Haskell-cafe] Takusen ODBC - MS Access

2009-08-31 Thread Günther Schmidt
Hi all, recently I had problems getting Takusen ODBC to work with MS-Access on Win32. It seems, that the problems originated from Takusens UTF8 code, the path of the Access Database contains an Umlaut. This even causes problems when one does not specify a connection String but merely a

Re: [Haskell-cafe] Get data from HTML pages

2009-08-31 Thread Jeremy Shaw
Hello, I would use TagSoup: http://community.haskell.org/~ndm/tagsoup/ It is was designed for exactly this type of thing. - jeremy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: cabal: : openFile: does not exist (No such file or directory)

2009-08-31 Thread Job Vranish
I got around this problem by downgrading to 6.10.3 (I think I rebuilt cabal as well) I'm not sure if the problem is with cabal, GHC, or some 64bit ubuntu library. (probably a combination of ghc+64bit ubuntu) Does anybody have ghc 6.10.4 working on 64bit Ubuntu? - Job On Mon, Aug 31, 2009 at

Re: [Haskell-cafe] Cleaning up stable names?

2009-08-31 Thread Job Vranish
I also would like a isStableNameTargetAlive function. Though if you had such a function then you probably _could_ make a deRefStableName function, which, since there isn't one, probably means that such a function would be hard to make. - Job On Sun, Aug 30, 2009 at 4:54 PM, Peter Verswyvelen

Re: [Haskell-cafe] GUI library

2009-08-31 Thread Job Vranish
I recommend qtHaskell. I am a big fan of Qt in general. It has good documentation and extensive examples, is very well designed, and has a good license. I'd even say the C++ version is good choice for beginners (certainly easier to understand/use than say GTK). The qtHaskell bindings are also

Re: [Haskell-cafe] Re: cabal: : openFile: does not exist (No such file or directory)

2009-08-31 Thread Paulo Tanimoto
Hello, On Mon, Aug 31, 2009 at 3:29 PM, Job Vranishjvran...@gmail.com wrote: I got around this problem by downgrading to 6.10.3 (I think I rebuilt cabal as well) I'm not sure if the problem is with cabal, GHC, or some 64bit ubuntu library. (probably a combination of ghc+64bit ubuntu) Does

Re: [Haskell-cafe] Slow IO?

2009-08-31 Thread Jason Dusek
I've updated Don Stewart's solution to compile with the modern ByteString libs. I'll be looking at ways to improve the performance of the `bytestring-nums` package. -- Jason Dusek http://github.com/jsnx/bytestring-nums/blob/d7de9db83e44ade9958fb3bfad0b29ede065b5dd/SPOJDons.hs

[Haskell-cafe] Dutch HUG: meeting next week (September 11th) in Utrecht

2009-08-31 Thread Tom Lokhorst
From lovely Edinburgh, I'd like to invite functional programmers in The Netherlands to the Dutch Haskell User Group [1, 2] meeting next Friday at 19:00. For the first time, we'll have people giving talks! Thomas (noknok) will be talking about his system for doing propositional logic in Haskell.

[Haskell-cafe] Re: Snow Leopard Breaks GHC

2009-08-31 Thread Dmitri Sosnik
On 31/08/2009, at 9:02 PM, Christian Maeder wrote: Dmitri Sosnik wrote: How I can tell gcc to generate 32 bit code? I've tried to set CFLAGS=-m32, but it doesn't work. (Flags do not work -- without Makefile) Pass Stupid me :-) -optc-m32 -opta-m32 -optl-m32 Yep, it work. Thanks!

Re: [Haskell-cafe] Re: Snow Leopard Breaks GHC

2009-08-31 Thread Tom Tobin
On Mon, Aug 31, 2009 at 7:18 PM, Dmitri Sosnikdim...@gmail.com wrote: On 31/08/2009, at 9:02 PM, Christian Maeder wrote: Dmitri Sosnik wrote: How I can tell gcc to generate 32 bit code? I've tried to set CFLAGS=-m32, but it doesn't work. (Flags do not work -- without Makefile) Pass

[Haskell-cafe] How to fix such a TYPE problem ?

2009-08-31 Thread zaxis
let [y,m,d] = map (\x - read x::Int) $ splitRegex (mkRegex -) 2009-08-31 fromGregorian y m d Couldn't match expected type `Integer' against inferred type `Int' In the first argument of `fromGregorian', namely `y' In the expression: fromGregorian y m d In the definition of `it': it =

Re: [Haskell-cafe] How to fix such a TYPE problem ?

2009-08-31 Thread Luke Palmer
On Mon, Aug 31, 2009 at 9:47 PM, zaxisz_a...@163.com wrote: let [y,m,d] = map (\x - read x::Int) $ splitRegex (mkRegex -) 2009-08-31 fromGregorian y m d Couldn't match expected type `Integer' against inferred type `Int'    In the first argument of `fromGregorian', namely `y'    In the

Re: [Haskell-cafe] Slow IO?

2009-08-31 Thread Eugene Kirpichov
Hm, on my machine Don's code has exactly the same performance my code above. Also, replacing the 'test' and 'parse' functions with this one add :: Int - Int - S.ByteString - Int add k i s = fst $ S.foldl' f (i, 0) s where f (!i, !n) '\n' | n`divisibleBy`k = (i+1, 0) |

Re[2]: [Haskell-cafe] GUI library

2009-08-31 Thread Bulat Ziganshin
Hello Job, Tuesday, September 1, 2009, 1:16:38 AM, you wrote: I recommend qtHaskell. how it's in areas of - memory deallocation when it's no more need - is it automatic or manual? - unicode support - compatibiliy with latest ghc versions - does it build by Cabal or we need to wait while gurus

Re: [Haskell-cafe] How to fix such a TYPE problem ?

2009-08-31 Thread zaxis
thanks! Luke Palmer-2 wrote: On Mon, Aug 31, 2009 at 9:47 PM, zaxisz_a...@163.com wrote: let [y,m,d] = map (\x - read x::Int) $ splitRegex (mkRegex -) 2009-08-31 fromGregorian y m d Couldn't match expected type `Integer' against inferred type `Int'    In the first argument of

Re: [Haskell-cafe] Slow IO?

2009-08-31 Thread Don Stewart
Good work guys. If you can abstract out a common function for lexing ints out of bytestrings, we could add it to the bytestring-lexing package. ekirpichov: Hm, on my machine Don's code has exactly the same performance my code above. Also, replacing the 'test' and 'parse' functions with this