Re: [Haskell-cafe] Generate 50 random coordinates

2006-12-03 Thread Henning Thielemann
On Fri, 1 Dec 2006, Huazhi (Hank) Gong wrote: myrand :: Int myrand = randomRIO(1::Int, 100) concerning random and IO: http://haskell.org/haskellwiki/Things_to_avoid#Separate_IO_and_data_processing ___ Haskell-Cafe mailing list

Re[2]: [Haskell-cafe] Re: Generate 50 random coordinates

2006-12-03 Thread Bulat Ziganshin
Hello Henning, Sunday, December 3, 2006, 1:37:08 PM, you wrote: Who rides so late through the bits and the bytes? It's Haskell with his child Hank; He has the boy type safe in his arm, He holds him pure, he holds him warm. I vote for an art/lyrics section on HaskellWiki. humor section

[Haskell-cafe] compiler versus interpreter

2006-12-03 Thread jepalomar23
I am programming an application with a lot of interactivity. When using x-getChar the character corresponding to the pushed key is assigned to x immediately. Launching the module through runghc works properly. However, the compiled module through ghc requires to push return after the character key

Re: [Haskell-cafe] Functional GUI combinators for arbitrary graphs of components?

2006-12-03 Thread Brian Hulley
Taral wrote: On 12/1/06, Brian Hulley [EMAIL PROTECTED] wrote: This problem is so general (ie converting a cyclic graph into an expression tree such that each node appears no more than once) that I'm sure someone somewhere must already have determined whether or not there can be a solution,

Re: [Haskell-cafe] Functional GUI combinators for arbitrary graphs ofcomponents?

2006-12-03 Thread Brian Hulley
Paul Hudak wrote: Brian Hulley wrote: Anyway to get to my point, though all this sounds great, I'm wondering how to construct an arbitrary graph of Fudgets just from a fixed set of combinators, such that each Fudget (node in the graph) is only mentioned once in the expression. To simplify the

Re: [Haskell-cafe] compiler versus interpreter

2006-12-03 Thread Chris Kuklewicz
[EMAIL PROTECTED] wrote: I am programming an application with a lot of interactivity. When using x-getChar the character corresponding to the pushed key is assigned to x immediately. Launching the module through runghc works properly. However, the compiled module through ghc requires to push

[Haskell-cafe] Typeclass question

2006-12-03 Thread Jonathan Tang
I've got what's probably a beginner's question, but I'm out of ideas for solving it. It looks like it tripped me up in Write Yourself a Scheme... too, since the code there seems like it's arranged so I never ran into it... I've got a couple functions: binop :: (AmbrosiaData - AmbrosiaData -

Re: [Haskell-cafe] Typeclass question

2006-12-03 Thread Stefan O'Rear
On Sun, Dec 03, 2006 at 12:26:30PM -0500, Jonathan Tang wrote: I've got what's probably a beginner's question, but I'm out of ideas for solving it. It looks like it tripped me up in Write Yourself a Scheme... too, since the code there seems like it's arranged so I never ran into it... I've

[Haskell-cafe] File locked unnecessarily

2006-12-03 Thread Arie Peterson
Hi, After a partial rewrite of my webserver, it is suffering from locked files: /path/to/file: openBinaryFile: resource busy (file is locked) The file in question really shouldn't be locked: - Only my server knows of the file's existence. - Only one thread accesses the file. - The

Re: [Haskell-cafe] File locked unnecessarily

2006-12-03 Thread Vyacheslav Akhmechet
Are you using hGetContents? If you are, take a closer look at the documentation. The function creates a lazy stream and until you finish reading from it the file will be in the semi-closed state (which means it will be locked). On 12/3/06, Arie Peterson [EMAIL PROTECTED] wrote: Hi, After a

[Haskell-cafe] Re: File locked unnecessarily

2006-12-03 Thread Arie Peterson
Vyacheslav Akhmechet [EMAIL PROTECTED] wrote: Are you using hGetContents? If you are, take a closer look at the documentation. The function creates a lazy stream and until you finish reading from it the file will be in the semi-closed state (which means it will be locked). No. I read/write

[Haskell-cafe] 2D Array

2006-12-03 Thread Tony Morris
I wish to pass a 2 dimensional array to use in a back-tracking algorithm. Since I will be doing lots of inserts, a Data.Array is unsuitable. It seems that a Map Int (Map Int a) is the most suitable structure, but this seems cumbersome. Is there anything more appropriate? -- Tony Morris

Re: [Haskell-cafe] 2D Array

2006-12-03 Thread Dean Herington
At 12:25 PM +1000 12/4/06, Tony Morris wrote: I wish to pass a 2 dimensional array to use in a back-tracking algorithm. Since I will be doing lots of inserts, a Data.Array is unsuitable. It seems that a Map Int (Map Int a) is the most suitable structure, but this seems cumbersome. Is there

Re: [Haskell-cafe] 2D Array

2006-12-03 Thread Neil Mitchell
Hi unsuitable. It seems that a Map Int (Map Int a) is the most suitable structure, but this seems cumbersome. You might want to use IntMap, which is a version of Map specialised to Int's, with better time bounds. Thanks Neil ___ Haskell-Cafe

[Haskell-cafe] complex state code

2006-12-03 Thread Tim Newsham
I'm working on some code where I have some complex state. This is the first time I've dealt with anything like this in haskell. If anyone would review my code and let me know if there are ways I could do this better, cleaner, in a more idiomatic way, etc, I would greatly appreciate it.

Re: [Haskell-cafe] 2D Array

2006-12-03 Thread Cale Gibbard
You might want to consider using a DiffArray, though if the backtracking is of just the wrong sort, you might get worse performance than you want. Updates are O(length xs) where xs is the list of updates to be performed (so O(1) in the singleton case), but lookups into older versions of the array