Re: Newbie question on statefullness

2002-08-11 Thread Andrew J Bromage
G'day all. On Sun, Aug 11, 2002 at 05:36:21PM -0700, Alex Peake wrote: I am new to Haskell. I want to do something very simple (I thought) but got lost in the world of Monads. I want to implement something like the C idea of: n += i So how does one doe this in Haskell? I think this

Combining type constraints

2002-08-08 Thread Andrew J Bromage
G'day all. I have a large number of functions all of which use the same set of type constraints, such as: foo :: (Monad m, Ord t, Show t) = ... Ideally, I'd like to combine them into one typeclass. At the moment, I'm using the equivalent of: class (Monad m, Ord t, Show t) =

Re: slightly ot: data structure question

2002-08-01 Thread Andrew J Bromage
G'day all. On Mon, Jul 29, 2002 at 02:50:55PM -0700, Hal Daume III wrote: I need a data structure which is a map from Ints to Doubles; the distribution of the Ints is in the range say 0-2 and a map will contain somewhere around 100-200 elements. I need to be able to query *very*

Re: good advanced fp (haskell) book

2002-07-31 Thread Andrew J Bromage
G'day all. On Wed, Jul 31, 2002 at 04:03:46PM -0700, Hal Daume III wrote: I'm not afraid of math (it was my undergraduate degree) and rather enjoy theorems, but I'm also insanely practical and am interested in a book which has a large section on *efficiency*. You might want to look through

Re: can a lazy language give fast code?

2002-07-31 Thread Andrew J Bromage
G'day all. On Wed, Jul 31, 2002 at 09:59:31AM +0100, D. Tweed wrote: It's in saying this is warranted by `almost all' processes being bound by things other than throughput which may be true in the average sense, but I don't think that all programmers have almost all their programming tasks

Re: can a lazy language give fast code?

2002-07-30 Thread Andrew J Bromage
G'day all. On Tue, Jul 30, 2002 at 08:14:27AM +0100, D. Tweed wrote: Mmm, such statements really assume that there's a sensible meaning to `almost always' when applied to the set of all programmers, whereas I think a much more realistic assumption is that `there's lots of people out there,

Re: can a lazy language give fast code?

2002-07-30 Thread Andrew J Bromage
G'day all. On Tue, Jul 30, 2002 at 01:57:58PM +0200, Josef Svenningsson wrote: I think the reason why Haskell compilers aren't generating any faster code is that there is a lack of competition among different compilers. And I think that the lack of competition depends on that noone wants to

Re: encapsulation

2002-07-07 Thread Andrew J Bromage
G'day all. On Mon, Jul 08, 2002 at 09:21:32AM +1200, Tom Pledger wrote: That's a matter of opinion. It's strong in all the areas I care about, but someone else may find it a pain that there's no way to prevent a module from exporting all its evidence declarations. It _is_ a matter of

Re: mergesort. Reply

2002-07-01 Thread Andrew J Bromage
G'day all. On Mon, Jul 01, 2002 at 09:04:37AM +0200, Ketil Z. Malde wrote: I was going to run through the statistics to work out the expected running time for a quick sort (i.e. sorting random data); Few programs routinely run on random data. Cheers, Andrew Bromage

Re: Writing a counter function

2002-06-30 Thread Andrew J Bromage
G'day all. On Sun, Jun 30, 2002 at 01:51:56PM +0100, Peter G. Hancock wrote: Why not have a monad m a = Int - (a,Int) which is a state monad plus the operation bump : Int - m Int bump k n = (n,n+k) Oh, ye of insufficient genericity. We can do better than that... import

Re: mergesort. Reply

2002-06-28 Thread Andrew J Bromage
G'day all. On Fri, Jun 28, 2002 at 09:44:11AM +0200, Ketil Z. Malde wrote: I, for one, am sorting expected, not worst-case, data :-) gripe What's this obsession with worst-case behaviour anyway? The best algorithm to use is the one which exploits known facts about the data. The converse

Re: type equivalency

2002-06-05 Thread Andrew J Bromage
G'day all. On Wed, Jun 05, 2002 at 08:20:03PM -0500, Jon Cast wrote: I think you're confused about what the type declarations mean. When you say sqrt :: Float - Float you're promising to operate over /all/ Floats. That would be true of Haskell functions were constrained to be total

Re: layout rule infelicity

2002-05-30 Thread Andrew J Bromage
G'day all. On Thu, May 30, 2002 at 01:10:03PM +0200, Johannes Waldmann wrote: Python has it as well (they stole it from Haskell?) Python's layout rule looks more like Occam's than Haskell's, to my eyes. Aside: Was Occam the first language of the post-punched-card era to use layout as syntax?

Re: Class Multiplicity

2002-05-18 Thread Andrew J Bromage
G'day all. On Thu, May 16, 2002 at 11:48:58PM -0700, Ashley Yakeley wrote: I have a curious Haskell design pattern. It's called one class per function. When used in conjunction with fundeps, I call it hacking C++-style function overloading. Sometimes I think it would be handy if the

Re: infix type constructors

2002-05-16 Thread Andrew J Bromage
G'day all. On Thu, May 16, 2002 at 07:24:10AM -0700, Simon Peyton-Jones wrote: I'm slowly getting around to this. Design questions: (A) I think it would be a good compromise to declare that operators like + are type *constructors* not type *variables*. So S+T would be a type.

Re: How to get functional software engineering experience?

2002-05-15 Thread Andrew J Bromage
G'day all. On Wed, May 15, 2002 at 12:53:30PM +0100, Claus Reinke wrote: Btw, I wouldn't subscribe to Andrew's opinion that there isn't a lot of functional (or even declarative) software engineering experience out there.. Just to clarify: I meant to emphasise the _declarative_ part rather

Re: Functional design patterns (was: How to get functional software engineering experience?)

2002-05-15 Thread Andrew J Bromage
G'day all. On Wed, May 15, 2002 at 08:13:22PM +0200, [EMAIL PROTECTED] wrote: BTW, FP is older than OOP. So why are we so late :-) ? I know you meant it as an offhand remark, but I think there are two serious reasons why. The first one is that OOP and GUIs happened at around the same time

Re: How to get functional software engineering experience?

2002-05-14 Thread Andrew J Bromage
G'day all. On Tue, May 14, 2002 at 04:47:13PM -0500, Jeffrey Palmer wrote: Are there any options for people like me, or does my functional experience remain limited to the hobby* work I can squeeze in at night and on weekends? Thoughts? The first thing you have to understand is that

Re: What's the '0' for in the version number?

2002-05-06 Thread Andrew J Bromage
G'day all. Why is it GHC 5.02.2, 5.03 etc.? Wouldn't it be easier with 5.2.2, 5.3? On Mon, May 06, 2002 at 11:44:03AM +0100, Simon Marlow wrote: I don't know, probably historical reasons: as far as I can remember, GHC's version numbers always had two digits after the decimal point. At

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: UniCode

2001-10-06 Thread Andrew J Bromage
G'day all. On Fri, Oct 05, 2001 at 06:17:26PM +, Marcin 'Qrczak' Kowalczyk wrote: This information is out of date. AFAIR about 4 of them is assigned. Most for Chinese (current, not historic). I wasn't aware of this. Last time I looked was Unicode 3.0. Thanks for the update. In

Re: UniCode

2001-10-05 Thread Andrew J Bromage
G'day all. On Fri, Oct 05, 2001 at 02:29:51AM -0700, Krasimir Angelov wrote: Why Char is 32 bit. UniCode characters is 16 bit. It's not quite as simple as that. There is a set of one million (more correctly, 1M) Unicode characters which are only accessible using surrogate pairs (i.e. two

Re: linking with c++ libraries

2001-07-30 Thread Andrew J Bromage
G'day all. On Mon, Jul 30, 2001 at 06:06:07AM -0700, Julian Seward (Intl Vendor) wrote: After some discussion in the GHC office, we're unsure about why you need to compile Main.c with a C++ compiler for this to work. Under g++ you may not strictly need it. I'm not sure about that. However,

Re: linking with c++ libraries

2001-07-20 Thread Andrew J Bromage
G'day all. On Sat, Jul 21, 2001 at 01:32:43AM +0800, Corneliu Popeea wrote: I'm trying to use from Haskell a C++ library (Omega Calculator). I'm using the following command: ghc -c -fglasgow-exts -package lang main.hs ghc main.o mylib.o -lomega -lstdc++ -fglasgow-exts -package lang Do

Re: MonadError and fundeps

2001-05-10 Thread Andrew J Bromage
G'day all. On Thu, May 10, 2001 at 09:24:36PM +, Marcin 'Qrczak' Kowalczyk wrote: BTW, another question: should MonadPlus instead of just Monad be a superclass of MonadError? It has a natural definition in terms of catchError. I can see how mplus has a natural definition (I can think of

Re: How to convert the type signature of a variable to a String?

2001-04-14 Thread Andrew J Bromage
G'day all. Mon, 9 Apr 2001 11:52:47 +0200, Pasch, Thomas (ACTGRO) [EMAIL PROTECTED] pisze: For example: 'function f' gives the String "a-a" On Sat, Apr 14, 2001 at 08:28:16PM +, Marcin 'Qrczak' Kowalczyk wrote: [...] In this form it's not even theoretically consistent: any

<    1   2