RE: Working character by character in Haskell

2001-10-19 Thread Simon Marlow
Humn... I agree with both of you, Albert and Tom. I started it from the beginning, using map and don't using reverse anymore. But the C program is still 7x faster than the Haskell one. Here is the code of the Haskell program: main :: IO () main = do bmFile - openFileEx in.txt

Re: Working character by character in Haskell

2001-10-19 Thread Ketil Malde
Simon Marlow [EMAIL PROTECTED] writes: Well, in Haskell each character of the string takes 20 bytes: 12 bytes for the list cell, and 8 bytes for the character itself Why does a list cell consume as much as 12 bytes? Two pointers (data and next) and a 32-bit tag field, perhaps? And a 64-bit

Strict functions

2001-10-19 Thread Ian Lynagh
Hi all I've been reading the GHC docs and they say that strict functions are good for space and time. Section 6.2 goes on to explain how to read the .hi files to determine the strictness of a function. However, it doesn't explain all the cases I am seeing. Example of the ones I've noticed are:

Multi-parameter OOP

2001-10-19 Thread George Russell
Recently I've been experimenting with a sort of OOP with GHC, using existential types and (overlapping, undecidable) multi-parameter type classes, but it doesn't seem to work as you might expect because of the way GHC resolves overloaded functions at compile-time. For example, given class A

Re: Strict functions

2001-10-19 Thread Andrew J Bromage
G'day all. On Fri, Oct 19, 2001 at 02:30:59PM +0100, Ian Lynagh wrote: Also, the prelude definition of zipWith has LVL whereas the following definition has LVV. Why is something like the following not used? zipWith :: (a-b-c) - [a] - [b] - [c] zipWith f (a:as) (b:bs) = f

RE: Working character by character in Haskell

2001-10-19 Thread Jan-Willem Maessen
Simon Marlow [EMAIL PROTECTED] writes: To really match the C program, you need to use IOExts.hGetBuf and IOExts.hPutBuf, and do the operations on raw characters in memory. Using a UArray of Word8 would be better, but there aren't any operations to do IO to/from a UArray yet (actually I've

Why is (monad) elegance so costly?

2001-10-19 Thread marku
I am about to rewrite my Z animation tool (JAZA) in a style that makes more intensive use of state monads. However, my experiments with a simplified lambda-calculus example shows that (with GHC 5.00) the state monad is dramatically less efficient than the simple identity monad: 4 TIMES

Re: Multi-parameter OOP

2001-10-19 Thread Marcin 'Qrczak' Kowalczyk
Fri, 19 Oct 2001 17:02:54 +0200, George Russell [EMAIL PROTECTED] pisze: So is there any other way of doing this sort of dynamic lookup at runtime, in a reasonably neat way? There is module Dynamic. I don't know if it helps or is reasonably neat. -- __( Marcin Kowalczyk * [EMAIL

Your Property Portfolio

2001-10-19 Thread Smith Hawkshaw Properties
£ 5 million worth of Bank Mortgage Reposessions Terraced houses ideal for renting. Tenants waiting. SMITH HAWKSHAW PROPERTIES Full Property Management Service available. Finance available from 5% fixed for 5 years Our family have been purveyors of properties for over 100 years. For

Re: Multi-parameter OOP

2001-10-19 Thread Ashley Yakeley
At 2001-10-19 08:02, George Russell wrote: a naive user (like me a month ago) might expect that this to work, so that toBool (WrappedA a) (WrappedB b) will return False unless a is an A1, and b a B1, in which case it returns True. I think existential types are arranged so that Haskell never