Re: [Haskell-cafe] semi-closed handles

2008-04-15 Thread Abhay Parvate
Thanks! I was worried about how/where would I place hClose! On Mon, Apr 14, 2008 at 10:58 PM, Brent Yorgey [EMAIL PROTECTED] wrote: 2008/4/14 Abhay Parvate [EMAIL PROTECTED]: Hello, In describing the Handle type, the GHC documentation says (in the System.IO documentation): GHC

Re: [Haskell-cafe] retrospective on 'seq' - 'unsafeSeq' ?

2008-04-15 Thread Ketil Malde
Bernie Pope [EMAIL PROTECTED] writes: Of course, [unsafeShow] won't be able to print functions in any helpful way, unless we attach source code information to functions as well (which may be worth doing anyway?). It might not be able to print the function's definition, but perhaps its type?

Re: [Haskell-cafe] Re: Embedding newlines into a string?

2008-04-15 Thread Tillmann Rendel
Benjamin L. Russel wrote: hanoi_shower ((a, b) : moves) | null moves = ... | otherwise == ... Luke Palmer wrote: More idiomatic pedantry: the way you will see most Haskellers write this style of function is by pattern matching rather than guards: hanoi_shower [] = ... hanoi_shower

Re: [Haskell-cafe] semi-closed handles

2008-04-15 Thread Ryan Ingram
I usually use something like this instead: hStrictGetContents :: Handle - IO String hStrictGetContents h = do s - hGetContents h length s `seq` hClose h return s This guarantees the following: 1) The whole file is read before hStrictGetContents exits (could be considered bad, but

Re: [Haskell-cafe] Help understanding sharing

2008-04-15 Thread Ryan Ingram
To add to this; sharing is not always what you want; sometimes it's a time/space trade-off and sometimes it's actually strictly worse than not sharing. For example: f :: Integer - [Integer] f x = take 1000 [x..] sum :: [Integer] - Integer sum = foldl' (+) 0 expensiveZero :: Integer

Re: [Haskell-cafe] HTTP and file upload

2008-04-15 Thread Adrian Neumann
Yes http://hpaste.org/6990 Am 14.04.2008 um 19:07 schrieb Adam Smyczek: Is form based file upload supported in HTTP module (HTTP-3001.0.4)? Adam ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] semi-closed handles

2008-04-15 Thread Abhay Parvate
Thanks Ryan, this will definitely not leak handles. I had thought about making a strict version of hGetContents, though on a bit different lines. My question was that since the documentation says that the semi-closed handle becomes closed as soon as the entire contents have been read; can I

[Haskell-cafe] Installing HaXml

2008-04-15 Thread rodrigo.bonifacio
Hi all, I've tried to install HaXml as explained in the documentation: runhaskell Setup.hs configure However, I get as response: dyld: Library not loaded: GNUreadline.framework/Versions/A/GNUreadline Referenced from: /usr/local/bin/runhaskell Reason: image not found Trace/BPT trap Any

Re: [Haskell-cafe] Installing HaXml

2008-04-15 Thread Malcolm Wallace
rodrigo.bonifacio [EMAIL PROTECTED] wrote: runhaskell Setup.hs configure dyld: Library not loaded: GNUreadline.framework/Versions/A/GNUreadline Referenced from: /usr/local/bin/runhaskell Reason: image not found Trace/BPT trap The problem is that 'runhaskell' invokes ghci (the

[Haskell-cafe] Module for parsing C (pre-processed header files only)?

2008-04-15 Thread Magnus Therning
Is there such a beast out there? If this were a list on some OO language I'd ask for something that created an AST and then offered an API based around a visitor pattern. The pre-processor (platform specific most likely, but could be cpphs of course) would be run prior to the tool I'm

[Haskell-cafe] NW Functional Programming Interest Group

2008-04-15 Thread Greg Meredith
All, Apologies for multiple listings. It's that time again. Our growing cadre of functionally-minded north westerners is meeting at the The Seattle Public Library 1000 - 4th Ave. Seattle, WA 98104 from 18:30 - 20:00 on April 16th. This meeting's agenda is a little more fluid, but... - i

Re: [Haskell-cafe] Module for parsing C (pre-processed header files only)?

2008-04-15 Thread Magnus Therning
On Tue, Apr 15, 2008 at 4:12 PM, Brian Sniffen [EMAIL PROTECTED] wrote: 2008/4/15 Magnus Therning [EMAIL PROTECTED]: Is there such a beast out there? Well, there's CIL (http://manju.cs.berkeley.edu/cil/), an OCaml library attacking the same problem. It has a very positive reputation.

[Haskell-cafe] Re: Installing HaXml

2008-04-15 Thread Christian Maeder
rodrigo.bonifacio wrote: Hi all, I've tried to install HaXml as explained in the documentation: runhaskell Setup.hs configure However, I get as response: dyld: Library not loaded: GNUreadline.framework/Versions/A/GNUreadline Referenced from: /usr/local/bin/runhaskell Reason:

[Haskell-cafe] Re: Module for parsing C (pre-processed header files only)?

2008-04-15 Thread benedikth
Magnus Therning schrieb: Is there such a beast out there? If this were a list on some OO language I'd ask for something that created an AST and then offered an API based around a visitor pattern. The pre-processor (platform specific most likely, but could be cpphs of course) would be run

[Haskell-cafe] Re: semi-closed handles

2008-04-15 Thread ChrisK
Ryan Ingram wrote: I usually use something like this instead: hStrictGetContents :: Handle - IO String hStrictGetContents h = do s - hGetContents h length s `seq` hClose h return s A small idiomatic nitpick: When I see (length s) gets computed and thrown away I wince at the

[Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-15 Thread Joe Buehler
John Goerzen wrote: So I have a need to write data to a POSIX named pipe (aka FIFO). Long story involving a command that doesn't have an option to read data from stdin, but can from a named pipe. How about /dev/stdin? -- Joe Buehler ___

Re: [Haskell-cafe] Re: semi-closed handles

2008-04-15 Thread Ryan Ingram
On 4/15/08, ChrisK [EMAIL PROTECTED] wrote: A small idiomatic nitpick: When I see (length s) gets computed and thrown away I wince at the wasted effort. I would prefer (finiteSpine s): On every piece of hardware I've seen, the actual calculation done by length is basically free. Compared to

[Haskell-cafe] monadic debugging

2008-04-15 Thread Galchin, Vasili
Hello, I have an Linux executable of my Haskell library and test case. I see there are several debuggers, e.g. Buddha, Hat, etc. Which debugger is currently preferred for monadic (imperative) code? Thanks. Vasili ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] monadic debugging

2008-04-15 Thread Bulat Ziganshin
Hello Vasili, Wednesday, April 16, 2008, 2:53:32 AM, you wrote: I have an Linux executable of my Haskell library and test case. I see there are several debuggers, e.g. Buddha, Hat, etc. Which debugger is currently preferred for monadic (imperative) code? Thanks. i use print mainly :)

[Haskell-cafe] GC'ing file handles and other resources

2008-04-15 Thread Conal Elliott
Are Haskell folks satisfied with the practical necessity of imperatively explicitly reclaiming resources such as file handles, fonts brushes, video memory chunks, etc? Doesn't explicit freeing of these resources have the same modularity and correctness problems as explicit freeing of system

Re: [Haskell-cafe] monadic debugging

2008-04-15 Thread Thomas Davie
On 16 Apr 2008, at 00:04, Bulat Ziganshin wrote: Hello Vasili, Wednesday, April 16, 2008, 2:53:32 AM, you wrote: I have an Linux executable of my Haskell library and test case. I see there are several debuggers, e.g. Buddha, Hat, etc. Which debugger is currently preferred for monadic

[Haskell-cafe] Wrong Answer Computing Graph Dominators

2008-04-15 Thread Denis Bueno
I'm using the Data.Graph.Inductive.Query.Dominators library (http://haskell.org/ghc/docs/latest/html/libraries/fgl/Data-Graph-Inductive-Query-Dominators.html) with GHC 6.8.2. The library is a bit spare on comments, so I may or may not be using it correctly. My goal is to compute the set of nodes

Re: [Haskell-cafe] monadic debugging

2008-04-15 Thread Bernie Pope
On 16/04/2008, at 10:16 AM, Thomas Davie wrote: On 16 Apr 2008, at 00:04, Bulat Ziganshin wrote: Hello Vasili, Wednesday, April 16, 2008, 2:53:32 AM, you wrote: I have an Linux executable of my Haskell library and test case. I see there are several debuggers, e.g. Buddha, Hat, etc.

[Haskell-cafe] Hackage being too strict?

2008-04-15 Thread John Goerzen
When I went to make my upload of MissingH 1.0.1, Hackage rejected it, saying: Instead of 'ghc-options: -XPatternSignatures' use 'extensions: PatternSignatures' It hadn't rejected MissingH 1.0.0, even though it had the same thing. Now, my .cabal file has this: -- Hack because ghc-6.6 and the

Re: [Haskell-cafe] Hackage being too strict?

2008-04-15 Thread Gwern Branwen
On 2008.04.15 22:15:29 -0500, John Goerzen [EMAIL PROTECTED] scribbled 0.7K characters: When I went to make my upload of MissingH 1.0.1, Hackage rejected it, saying: Instead of 'ghc-options: -XPatternSignatures' use 'extensions: PatternSignatures' It hadn't rejected MissingH 1.0.0, even

Re: [Haskell-cafe] Hackage being too strict?

2008-04-15 Thread John Goerzen
On Tuesday 15 April 2008 10:53:03 pm Gwern Branwen wrote: On 2008.04.15 22:15:29 -0500, John Goerzen [EMAIL PROTECTED] scribbled 0.7K characters: When I went to make my upload of MissingH 1.0.1, Hackage rejected it, saying: Instead of 'ghc-options: -XPatternSignatures' use 'extensions:

[Haskell-cafe] ANN: datapacker 1.0.0

2008-04-15 Thread John Goerzen
Hi, I'm pleased to announce the first release of datapacker. datapacker is a tool to pack files into a minimum number of CDs, DVDs, or any other arbitrary bin. It groups file by size. It is designed to group files such that they fill fixed-size containers (called bins) using the minimum number

Re: [Haskell-cafe] Re: Embedding newlines into a string?

2008-04-15 Thread Benjamin L. Russell
Ok; I rewrote my recursive version of hanoi, preserving my semantics (i.e., working for lists of length 1 or more, rather than 0 or more, to start with) in a more Haskell-idiomatic manner; viz: hanoi_general_recursive.hs: hanoi :: a - a - a - Int - [(a, a)] hanoi source using dest n | n == 1

Re: [Haskell-cafe] GC'ing file handles and other resources

2008-04-15 Thread Abhay Parvate
Your mail gives me an idea, though I am not an iota familiar with compiler/garbage collector internals. Can we have some sort of internally maintained priority associated with allocated objects? The garbage collector should look at these objects first when it tries to free anything. The objects