What's difference between Integer and Int?

2003-08-19 Thread Serguey Zefirov
Hello glasgow-haskell-users, The following program --- --main = print (show (fibs!!20)) main = print (show (nth 20 fibs)) nth 0 (h:_) = h nth n (h:t) = nth (n-1) t fibs :: [Integer] -- fibs = 1 : (map snd $ iterate (\(x,y) - (y, x+y)) (1,1))

Re: What's difference between Integer and Int?

2003-08-19 Thread Carsten Schultz
Hi Serguey! On Tue, Aug 19, 2003 at 03:14:53PM -0700, Serguey Zefirov wrote: Hello glasgow-haskell-users, The following program --- --main = print (show (fibs!!20)) main = print (show (nth 20 fibs)) nth 0 (h:_) = h nth n (h:t) = nth

GHC 6.0.1 for Mac OS X available through darwinports

2003-08-19 Thread Gregory Wright
Hello, GHC 6.0.1 for Mac OS X is now available through the darwinports system. Darwinports is similar to the *BSD port system. It downloads and builds both the target and dependencies automatically for your machine. Note that darwinports is still under development. OS X users who want a

Hash functions

2003-08-19 Thread George Russell
Many thanks for Data.HashTable, which I am about to use. Unfortunately I seem to need an unseemly hack because the key I want, namely ThreadId's, don't have a hash function defined, and defining one requires me to muck around with GHC internal functions. Could some more hash functions be

2nd CfP: SNPD'03 Workshop on High-Level Approaches to Parallel and Distributed Computing

2003-08-19 Thread Clemens Grelck
Please apologize in case you receive multiple copies of this information. == 2nd CALL FOR PAPERS Workshop on High-Level Approaches to Parallel and Distributed Computing held in the context of the

RE: more unsafePerformIO questions (is it safe to use with ReadMode Handles)?

2003-08-19 Thread Simon Marlow
I'm finishing up my Haskell interface to WordNet (http://www.cogsci.princeton.edu/~wn/) and have a standard unsafePerformIO question :). Basically, the interface functions by first calling an initialization function, 'initializeWordNet :: IO WordNetEnv'. WordNetEnv is essentially just a

Re: overlapping instances and functional dependencies

2003-08-19 Thread Wolfgang Jeltsch
Hello, I think, I realized now what my mistake was. The handling of overlapping instances comes into play when the compiler has to decide which method definition to choose for a specific instance. It is not for choosing one of more possible instances. In my example, C Int (Int,Char,Bool) Int

Re: more unsafePerformIO questions (is it safe to use with ReadMode Handles)?

2003-08-19 Thread Ganesh Sittampalam
On Tue, 19 Aug 2003 10:27:23 +0100, Simon Marlow [EMAIL PROTECTED] wrote: If the databases *do* change over time, then there are two possibilities: 1. the contents change due to external factors only 2. the contents change because this program doing the writing in (1), you can still pretend

RE: more unsafePerformIO questions (is it safe to use with ReadMode Handles)?

2003-08-19 Thread Simon Marlow
If the databases *do* change over time, then there are two possibilities: 1. the contents change due to external factors only 2. the contents change because this program doing the writing in (1), you can still pretend the interface is pure, by imagining that all the changes

Re: more unsafePerformIO questions (is it safe to use with ReadMode Handles)?

2003-08-19 Thread Ganesh Sittampalam
On Tue, 19 Aug 2003 10:52:57 +0100, Simon Marlow [EMAIL PROTECTED] wrote: Isn't there the possibility of inlining causing a read to happen twice even if it only appears to happen once? In theory that would be a valid transformation, but in practice no compiler would duplicate arbitrary

RE: more unsafePerformIO questions (is it safe to use with ReadMode Handles)?

2003-08-19 Thread Simon Marlow
Isn't there the possibility of inlining causing a read to happen twice even if it only appears to happen once? In theory that would be a valid transformation, but in practice no compiler would duplicate arbitrary computations. GHC certainly doesn't. I was thinking of a situation

Re: more unsafePerformIO questions ([...])

2003-08-19 Thread Wolfgang Jeltsch
On Tuesday, 2003-08-19, 13:18, Simon Marlow wrote: [...] Yes, I agree that one shouldn't rely on the no duplication of work property. However, folloing this argument we arrive at the conclusion that hGetContents is an invalid use of unsafePerformIO. (which is something I've been saying for

RE: more unsafePerformIO questions ([...])

2003-08-19 Thread Simon Marlow
On Tuesday, 2003-08-19, 13:18, Simon Marlow wrote: [...] Yes, I agree that one shouldn't rely on the no duplication of work property. However, folloing this argument we arrive at the conclusion that hGetContents is an invalid use of unsafePerformIO. (which is something I've

Announce: HWordNet - A Haskell Interface to WordNet

2003-08-19 Thread Hal Daume III
Briefly, http://www.isi.edu/~hdaume/HWordNet/ HWordNet is a Haskell binding to the WordNet database. You will actually need to have WordNet installed to use the Haskell interface, but you won't need any of the source (the Haskell interface is 100% pure Haskell; no crummy FFI bindings here!).

Re: more unsafePerformIO questions (is it safe to use with ReadMode Handles)?

2003-08-19 Thread Andrew J Bromage
G'day all. On Tue, Aug 19, 2003 at 11:11:23AM +0100, Ganesh Sittampalam wrote: I was thinking of a situation like let x = unsafePerformIO readFooFromDB in x+x I see from your Secrets of the GHC inliner paper that x wouldn't be inlined by GHC, but it seems to me like a serious abuse of

ANNOUNCE: New Chameleon version (03-08)

2003-08-19 Thread Martin Sulzmann
Latest version can be downloaded via http://www.comp.nus.edu.sg/~sulzmann/chameleon/ You might also want to check out http://www.comp.nus.edu.sg/~sulzmann/chr/publications.html - The Chameleon Type Debugger (Tool Demonstration) - Interactive Type Debugging in Haskell Martin

let vs. where [was: Re: more unsafePerformIO questions (is it safe to use with ReadMode Handles)?]

2003-08-19 Thread Jan Scheffczyk
Hi Andrew, let x = expensiveComputation foo in x + x I would certainly hope that expensiveComputation wasn't called twice, and even though the language doesn't guarantee it, I have already written code that assumed it. I always thought that there is a tiny difference between let and

RE: Database interface

2003-08-19 Thread Tim Docker
Tom Pledger writes: By the way, how does the a in a - b - IO (b, Bool) work? It looks like it has something to do with the current row. Does doquery have to accommodate any possible substitution for a ? I fired this off without thinking about it too much, and looking at the prelude type

Re: More type design questions

2003-08-19 Thread Konrad Hinsen
On Monday 18 August 2003 22:24, Remi Turk wrote: Would this suffice? ... I guess so - it looks like what Brandon proposed, up to cosmetic differences. Still, those cosmetic differences give me the chance to ask another question. instance Functor Vector where fmap f (Vector x y z)

Monads and Maybe

2003-08-19 Thread Konrad Hinsen
I have been following the recent Monad tutorial discussion with interest, and even read the tutorial, which is a useful addition to the existing Haskell documentation. So useful in fact that it raises a question... The whole monad mechanism seems to geared towards functions of one argument,

sequencing data structures

2003-08-19 Thread Martin Norbäck
I want to sequence data structures in an efficient manner, to store them to files and to send them over the network. Simply deriving Show and Read is not very good, because it's space inefficient and read cannot give any output until the whole data structure is parsed. So I thought I should

Re: sequencing data structures

2003-08-19 Thread Iavor Diatchki
hello, there were a lot of discussions on the library mailing list about deriving binary, which is related to what you are asking. i don't think that dealt with cyclic datatypes though. i don't think you can do much about that from within haskell, unless you somehow encoded the sharing

Re: More type design questions

2003-08-19 Thread Andrew J Bromage
G'day all. On Tue, Aug 19, 2003 at 12:31:08PM +0200, Konrad Hinsen wrote: Under what conditions would Haskell programmers make some type an instance of Functor? Whenever it could possibly be done (i.e. whenever fmap makes sense)? Or just when fmap would be used frequently for some type?