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: 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: 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: 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: 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: 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: 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: 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: new version of edison?

2002-10-15 Thread Andrew J Bromage
G'day all. On Tue, Oct 15, 2002 at 04:47:22PM -0700, Hal Daume III wrote: I was wondering if anyone has a brand-spaking-new version of edison or anything like it. The edison docs still refer to ghc 4.06, which can't be good. If not, is there an edison-like project out there? Chris Okasaki

Re: forall and class contexts

2002-10-16 Thread Andrew J Bromage
G'day all. On Wed, Oct 16, 2002 at 08:40:18AM +0100, Simon Peyton-Jones wrote: There aren't many type constructors T for which T a is an equality type... I can think of a few, like IORef. Admittedly I can't think of any that are also monads. Cheers, Andrew Bromage

Re: Rational sequence

2002-10-24 Thread Andrew J Bromage
G'day all. On Thu, Oct 24, 2002 at 04:05:05PM +0100, Simon Peyton-Jones wrote: I definitely can't do that at this stage. I have never liked Float/Double/Ratio being in Enum, but there is no possibility of removing them now. A year or two ago, maybe. Just to clarify: Did you mean for

Re: diff in Haskell: clarification

2002-11-21 Thread Andrew J Bromage
G'day all. On Fri, Nov 22, 2002 at 05:13:07AM +1100, Fergus Henderson wrote: Would a Mercury version help? The Mercury distribution includes a Mercury version of Myer's algorithm: it's in the directory `samples/diff'. Disclaimer: I wrote the Mercury version. That particular algorithm

Re: diff in Haskell: clarification

2002-11-25 Thread Andrew J Bromage
G'day all. On Mon, Nov 25, 2002 at 12:19:10PM +0100, George Russell wrote: I have a confession to make. Andrew Bromage's list-based code is much faster than my array-based code. So I think I shall end up adapting Andrew Bromage's code, even though I do not understand it. You mean you did

Re: AW: slide: useful function?

2002-12-01 Thread Andrew J Bromage
G'day all. On Thu, Nov 28, 2002 at 12:32:19PM -0500, Paul Hudak wrote: reminds of what I think is one of the biggest problems with conventional software development: the lack of appreciable mathematics in the specification, design, coding, or implementation of programs. In the interest of

Re: AW: slide: useful function?

2002-12-02 Thread Andrew J Bromage
G'day all. On Mon, Dec 02, 2002 at 08:26:06AM +0100, Johannes Waldmann wrote: well I love design patterns, it's just that in Haskell-land they are called higher-order functions, or polymorphic functions, etc. Can I safely translate that as We use design patterns but we don't like the name?

Re: AW: slide: useful function?

2002-12-02 Thread Andrew J Bromage
G'day all. On Mon, Dec 02, 2002 at 10:27:21AM +0100, John Hughes wrote: There are patterns of that sort in our programs, which we would probably rather call design techniques, which aren't so easily captured by a higher-order function definition. As a matter of interest, _why_ would we

Re: AW: slide: useful function?

2002-12-02 Thread Andrew J Bromage
G'day all. On Mon, Dec 02, 2002 at 01:05:27PM -0500, David Bergman wrote: It seems like all the patterns, at least the ones in the GoF's enumeration, can be expressed as higher-order functions and classes if we only would have a way to traverse a record structure dynamically. If someone can

Re: AW: slide: useful function?

2002-12-03 Thread Andrew J Bromage
G'day all. Just to clarify... On Tue, Dec 03, 2002 at 12:42:21PM -0500, David Bergman wrote: But, design patterns are clearly overestimated as a tool for (indirect) code production, you are right in that. Absolutely agreed. Design patterns are little more than: - A common language

Re: Question About lists

2002-12-31 Thread Andrew J Bromage
G'day all. On Mon, Dec 30, 2002 at 01:47:37PM -0600, Artie Gold wrote: One suggestion, though is that you're working too hard; there's really no reason to define a locally defined function. The much simpler: long [] = 0 long (x:xs) = 1 + long xs will do quite nicely. It has quite

Re: Question About lists

2003-01-01 Thread Andrew J Bromage
G'day all. On Wed, 1 Jan 2003, Andrew J Bromage wrote: It has quite different performance characteristics, though. In particular, this uses O(n) stack space whereas the accumulator one uses O(1) stack space. On Wed, Jan 01, 2003 at 12:17:10PM +0200, Shlomi Fish wrote: This is assuming

Re: Question About lists

2003-01-02 Thread Andrew J Bromage
G'day all. On Thu, Jan 02, 2003 at 08:39:18AM +, Alastair Reid wrote: Please note that this is NOT TRUE! Whoops, you're right. Sorry, my mistake. Cheers, Andrew Bromage ___ Haskell mailing list [EMAIL PROTECTED]

Re: Field labels must be globally unique?

2003-01-07 Thread Andrew J Bromage
G'day all. On Tue, Jan 07, 2003 at 10:01:38PM -0600, Kim-Ee Yeoh wrote: Why can't field labels have the same name in different types? Because it would generate two functions with the same name. I'm not an expert on programming languages, but doesn't it seem that Haskell, as a strongly-typed

Re: dynamic types

2003-01-14 Thread Andrew J Bromage
G'day all. On Tue, Jan 14, 2003 at 07:13:57PM +1100, Fergus Henderson wrote: That's not the only problem. The other problem is that because `Typeable' instances aren't built-in, `fromDynamic' is not type-safe. The implementation of `fromDynamic' calls `typeOf' and then if the types match,

Re: seeking ideas for short lecture on type classes

2003-01-24 Thread Andrew J Bromage
G'day all. On Fri, Jan 24, 2003 at 06:13:29PM -0500, Norman Ramsey wrote: In a fit of madness, I have agreed to deliver a 50-minute lecture on type classes to an audience of undergraduate students. These students will have seen some simple typing rules for F2 and will have some exposure to

Re: type classes vs. multiple data constructors

2003-02-17 Thread Andrew J Bromage
G'day. On Mon, Feb 17, 2003 at 01:44:07AM -0500, Mike T. Machenry wrote: I was wondering if it's better to define them as type classes with the operations defined in the class. What do haskellian's do? I can't speak for other Haskellians, but on the whole, it depends. Here's the common

Re: Interesting Read (fwd)

2003-02-19 Thread Andrew J Bromage
G'day. On Wed, Feb 19, 2003 at 09:46:02AM -0600, Rex Page wrote: Here are two things I found interesting: 1. The author comments that programs are not theorems. No, he argues that programming _languages_ are not theorems. All that is required of a theorem is that it is correct. A tool, on

Re: proposal for anonymous-sum syntax

2003-02-21 Thread Andrew J Bromage
G'day all. On Fri, Feb 21, 2003 at 04:28:27PM -0800, Richard Nathan Linger wrote: What do people think about this? Has anyone else ever wished they had such support for unnamed sums? I sometimes wish that Haskell did _not_ have support for unnamed product types. To be honest, how hard is it

Re: int to float problem

2003-03-04 Thread Andrew J Bromage
G'day all. On Mon, Mar 03, 2003 at 12:10:28PM -0500, Matthew Donadio wrote: This is my biggest gripe with Haskell, at least for what I do. The numeric class system is good, but it assumes that the sub-classes are distict, where in fact integers are a proper subset of reals, which are a

Re: polymorphic type in state of state monad

2003-03-10 Thread Andrew J Bromage
G'day all. On Tue, Mar 11, 2003 at 08:34:06AM +1300, Tom Pledger wrote: If, on the other hand, you want to vary the state type *during* a single monadic computation, it gets messy. You could try one of the following. Very often, you just want to vary the state type for some portion of the

[tim@epicgames.com: Fw: Typesafe MRef with a regular monad]

2003-06-05 Thread Andrew J Bromage
G'day all. On Wed, Jun 04, 2003 at 07:31:03PM -0500, Tim Sweeney wrote: Conjecture: It's impossible to implement RefMonad directly in Haskell without making use of built-in ST or IO functionality and without unsafe or potentially diverging code (such as unsafeCoerce). Any takers? WARNING:

Language extension proposal

2003-06-24 Thread Andrew J Bromage
G'day all. I've been toying with an idea for a small language extension, and I was curious what you all think of this. As a motivating example, consider the following standard typeclass: class Bounded a where min :: a max :: a This is an example of what I refer

Re: Language extension proposal

2003-06-25 Thread Andrew J Bromage
G'day all. On Wed, Jun 25, 2003 at 08:48:12AM -0700, Hal Daume wrote: I'm not sure this is really necessary (at least syntax-wise). Well, of course, no extension is absolutely necessary in a Turing-hard language. :-) For the record, here are a couple of other solutions which avoid the

Re: Suffix Tree

2003-07-01 Thread Andrew J Bromage
G'day. On Tue, Jul 01, 2003 at 10:02:36AM +0200, [EMAIL PROTECTED] wrote: Does anybody know of a suffix tree implementation for Haskell? Are there algorithms for a (lazy) functional setting? Yes. Take a look here: http://www.techfak.uni-bielefeld.de/~kurtz/publications.html The

Re: Higher rank types

2003-07-07 Thread Andrew J Bromage
G'day all. On Mon, Jul 07, 2003 at 11:23:59AM +0100, Simon Peyton-Jones wrote: The paper has a strongly tutorial flavour, and comes complete with a prototype implementation that you can play with. Does the prototype implementation not support recursive lets? *Main tcs let fix = (\\f

Re: Higher rank types

2003-07-08 Thread Andrew J Bromage
G'day all. On Tue, Jul 08, 2003 at 08:56:10AM +0100, Simon Peyton-Jones wrote: No it does not. As the paper explains. Serves me right for playing with the toy before I read the manual. Cheers, Andrew Bromage ___ Haskell mailing list [EMAIL

Re: How overload operator in Haskell?

2003-07-09 Thread Andrew J Bromage
G'day all. On Wed, Jul 09, 2003 at 05:25:20PM +0200, Jerzy Karczmarczuk wrote: While this is a possible solution, I would shout loudly: Arrest this man, he is disrespectful wrt math!. Actually, this shows once more that the Num class and its relatives is a horror... Yup. I recently

Re: How overload operator in Haskell?

2003-07-11 Thread Andrew J Bromage
G'day all. On Thu, Jul 10, 2003 at 11:16:56PM -0700, Ashley Yakeley wrote: As written, this is _not_ a good idea. Trust me, you end up having to put type annotations everywhere. Even (3 + 4 :: Integer) is ambiguous, you have to write (3 :: Integer) + (4 :: Integer). But that's what

Re: How overload operator in Haskell?

2003-07-12 Thread Andrew J Bromage
G'day all. On Fri, Jul 11, 2003 at 04:28:19PM -0400, Dylan Thurston wrote: Don't be silly [...] Never! Cheers, Andrew Bromage ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell

Re: User-Defined Operators

2003-07-17 Thread Andrew J Bromage
G'day all. On Thu, Jul 17, 2003 at 05:21:47PM +0200, Christian Maeder wrote: Why do you outrule other useful libraries (see above). In fact ($) is quite cryptic (for a non-Haskeller). Actually this gives me a perfect opportunity to rant a bit. :-) ($) is a wart, even for a Haskeller. It

Re: User-Defined Operators, Re: Function composition and currying

2003-07-17 Thread Andrew J Bromage
G'day all. On Thu, Jul 17, 2003 at 04:46:13PM +0100, Jon Fairbairn wrote: Someone mentioned multiplying by a scalar. I think this is a good application, but what we need is to agree (somehow) on the symbol used. I've used (*.) and (.*), with the dot being on the side the scalar is on (on the

Re: User-Defined Operators, Re: Function composition and currying

2003-07-18 Thread Andrew J Bromage
G'day all. On Fri, Jul 18, 2003 at 04:08:25AM -0400, Dylan Thurston wrote: What's wrong with that solution? Working with these operators, I would spend a significant amount of time getting the '' and '' notations right rather than writing code. I don't like that. For example, using the

Re: User-Defined Operators (ad-hoc overloading)

2003-07-18 Thread Andrew J Bromage
G'day all. On Fri, Jul 18, 2003 at 11:08:16AM +0200, Christian Maeder wrote: Mere overload resolution (over monomorphic types) is not NP-hard. (This is only a common misconception.) No, but as you note below, the interesting cases are. Most of the more interesting number-like types are

Re: User-Defined Operators, Re: Function composition and currying

2003-07-19 Thread Andrew J Bromage
G'day all. On Sat, Jul 19, 2003 at 01:52:32AM -0400, Dylan Thurston wrote: It's maybe easiest to think in terms of group theory with an action on a set: you're just distinguishing between the multiplication of group elements and the actual action. This distinction is not usually reflected

Re: User-Defined Operators (ad-hoc overloading)

2003-07-21 Thread Andrew J Bromage
G'day all. On Mon, Jul 21, 2003 at 01:07:39PM +0200, Christian Maeder wrote: Mere overload resolution (over monomorphic types) is not NP-hard. (This is only a common misconception.) I can only repeat my above sentence. I'm a firm believer in the maxim that the best way to find information

Re: overlapping instances and functional dependencies

2003-08-14 Thread Andrew J Bromage
G'day all. On Sat, Aug 09, 2003 at 01:32:49AM +0200, Wolfgang Jeltsch wrote: ghci -fglasgow-exts -fallow-overlapping-instances compiles it without complaint If it helps, ghci will complain the first time you actually try to use it. Cheers, Andrew Bromage

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

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

2003-08-20 Thread Andrew J Bromage
G'day all. On Wed, Aug 20, 2003 at 07:42:59AM +0200, Jan Scheffczyk wrote: I always thought that there is a tiny difference between let and where: They're semantically equivalent. See, for example: http://haskell.org/onlinereport/decls.html#sect4.4.3.2 Cheers, Andrew Bromage

Re: Interval arithmetic

2003-08-28 Thread Andrew J Bromage
G'day all. On Wed, Aug 27, 2003 at 04:03:52PM +, Jonas Ritter wrote: + :: Intervall - Intervall - Intervall (a,b) + (c,d) = (a+c,b+d) In general this is insufficient because of floating point rounding. The standard IEEE 754 rounding rule is the floating point equivalent of rounding to

Re: Exhaustive Pattern-Matching

2003-08-29 Thread Andrew J Bromage
G'day all. On Wed, Aug 27, 2003 at 04:57:27PM +0100, Simon Marlow wrote: GHC tries to do so, but sometimes gets it wrong. See the -fwarn-incomplete-patterns flag. We'd appreciate it if someone could overhaul this code - it's been on the wish list for a long time. As a matter of curiosity,

Re: Haskell for non-Haskell's sake

2003-09-02 Thread Andrew J Bromage
G'day all. On Fri, Aug 29, 2003 at 05:39:09PM -0700, Hal Daume III wrote: I'm attempting to get a sense of the topology of the Haskell community. I used Haskell to write a compiler for the RenderMan shading language for a former employer. Unfortunately, the compiler never shipped. I still

Re: The Future of Haskell discussion at the Haskell Workshop

2003-09-09 Thread Andrew J Bromage
G'day all. On Tue, Sep 09, 2003 at 02:52:48PM +0200, Johannes Waldmann wrote: but this might be an issue for others, who have to maintain legacy code. You know a language has made it when we're talking about legacy code. On the other hand, you have to worry about a pure declarative language

Compiler panic

2002-10-29 Thread Andrew J Bromage
G'day all. On a very recently checked out copy of GHC (late last week, from memory) I get the following panic: % ghc -fglasgow-exts -c Bug.hs ghc-5.05: panic! (the `impossible' happened, GHC version 5.05): applyTys Please report it as a compiler bug to [EMAIL PROTECTED], or

Bug in do expressions

2002-11-20 Thread Andrew J Bromage
G'day all. In a recent GHC checkout, the following program: module Main(main) where import Maybe import Control.Monad test :: (MonadPlus m) = [a] - m Bool test xs = do (_:_) - return xs return True `mplus` do

Re: Bug in do expressions

2002-11-21 Thread Andrew J Bromage
G'day all. On Thu, Nov 21, 2002 at 09:12:58AM -, Simon Peyton-Jones wrote: So GHC is 30 lines shorter thanks to you. ...and I didn't even have to delete a single line of code myself! Thanks, Simon. Cheers, Andrew Bromage ___

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

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: 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: 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: 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: 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: 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: 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: 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: foralls in newtypes

2002-10-16 Thread Andrew J Bromage
G'day all. On Wed, Oct 16, 2002 at 07:54:17AM -0700, Hal Daume III wrote: I was reading the HFL libs, namely Control.Monad.Logic, and there's a definition in there: newtype Logic a = Logic { mkLogic :: (forall b. (a - b - b) - b - b) } I'm curious why this is legal, but newtype

Re: RFC: External library infrastructure

2002-11-12 Thread Andrew J Bromage
G'day all. On Tue, Nov 12, 2002 at 05:25:42PM +, Alastair Reid wrote: So as people try to come up with a distribution and build mechanism that will work for GHC, it would be good to think about how that same mechanism would work for Hugs too. If you will allow me to AOL... Me too!

Re: Sending wide characters over the network socket

2003-07-06 Thread Andrew J Bromage
G'day all. On Sat, Jul 05, 2003 at 11:44:54PM -0400, Dimitry Golubovsky wrote: What would be really nice to have is some sort of object input/output over network. Then, by sending a String, I would expect it to be recreated at the other end. And if the other end expects, say [Int] then an

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

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: Newbie question on statefullness

2002-08-11 Thread Andrew J Bromage
G'day all. On Sun, Aug 11, 2002 at 07:03:04PM -0700, Alex Peake wrote: I am trying to implement a long-lived accumulator How long is long? Over what kind of code must it be preserved? In what kind of code do you want to modify it and in what kind of code do you want to read it? By what

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

Re: Newbie question on statefullness

2002-08-13 Thread Andrew J Bromage
G'day all. On Mon, Aug 12, 2002 at 10:06:51PM +0100, Alistair Bayley wrote: OTOH, if you want to do anything useful with any language you have to learn to do IO (and simple IO is tackled early in most languages), and therefore you must deal with Monads. I often wish that Haskell books and

Haskell wiki problems

2002-08-13 Thread Andrew J Bromage
G'day all. On Mon, Aug 12, 2002 at 04:19:38AM -0700, John Meacham wrote: grr. this used to be in a FAQ at the Wiki. whatever happened to that? Unfortunately, the ReportingProblems page is one of the ones which died. It's also not in the google cache. Does anyone know who's responsible for

Re: Question about use of | in a class declaration

2002-08-21 Thread Andrew J Bromage
G'day all. On Wed, Aug 21, 2002 at 02:46:16PM -0400, Mark Carroll wrote: One issue we have here is that any Haskell we write is stuff we'll probably want to keep using for a while so, although we've only just got most of the bugs out of the H98 report, I'll certainly watch with interest as

Re: Question about use of | in a class declaration

2002-08-21 Thread Andrew J Bromage
G'day all. On Wed, Aug 21, 2002 at 02:31:05PM +0100, Guest, Simon wrote: Please could someone explain the meaning of | in this class declaration (from Andrew's example): class (Ord k) = Map m k v | m - k v where lookupM :: m - k - Maybe v Others have answered the question

Re: Dealing with configuration data

2002-09-25 Thread Andrew J Bromage
G'day all. On Thu, Sep 26, 2002 at 12:06:36AM +0100, Liyang Hu wrote: The problem I'm having is with the preferences: How do I make it available throughout the entire program? (FWIW, most of the work is effectively done inside the IO monad.) I could explicitly pass the record around

Re: Dealing with configuration data

2002-09-28 Thread Andrew J Bromage
G'day all. On Fri, Sep 27, 2002 at 12:56:38PM -0400, Dean Herington wrote: I'm not sure why you consider the code you refer to above so ugly. Anything which relies on unsafePerformIO (or seq, for that matter) is ugly. Personal opinion, of course. :-) Question: Why do you use `seq` on

Re: need help optimizing a function

2002-10-09 Thread Andrew J Bromage
G'day all. On Wed, Oct 09, 2002 at 02:29:26PM -0400, David Roundy wrote: I get a speedup of about a factor of 6 for the test files I was using (of course, this would depend on file size), and find that now only 2% of my time is spent in that function. I'm still something like 100 times

Re: infinite (fractional) precision

2002-10-10 Thread Andrew J Bromage
G'day all. On Thu, Oct 10, 2002 at 11:50:39AM +0200, Jerzy Karczmarczuk wrote: There are of course more serious approaches: intervals, etc. The infinite- precision arithmetic is a mature domain, developed by many people. Actually the Gosper arithmetic of continued fractions is also based on

Re: representation getting verbose...

2002-10-22 Thread Andrew J Bromage
G'day all. On Thu, Oct 17, 2002 at 11:08:57AM -0400, [EMAIL PROTECTED] wrote: For an interpreter I'm writing, I found myself writing a function constructVarExpr :: String - Expr just to make it easier. As an alternative opinion, I don't think there's anything wrong with this. A constructor

Re: dozen

2002-10-26 Thread Andrew J Bromage
G'day all. On Sat, Oct 26, 2002 at 11:40:04AM -0700, Nuno Silva wrote: can anyone help me how to get the dozen number? using Int example dozen 1020 the expected result is: 2 dozen :: Int - Int dozen 1020 = 2 Hope this helps. Cheers, Andrew Bromage

Re: can't find sequence?

2002-10-28 Thread Andrew J Bromage
G'day all. On Mon, Oct 28, 2002 at 08:47:08AM +, Alastair Reid wrote: (btw There were some remarks that Chris's library might be dropped from distributions because no-one is supporting it. I don't recall whether a decision was made on this.) If Jason is using a version of Edison that

Re: Last generator in do {...}

2002-10-29 Thread Andrew J Bromage
G'day all. On Tue, Oct 29, 2002 at 11:20:47AM +0200, George Kosmidis wrote: I am sure there are a billion errors in this. This is the first one: Line:17 - Last generator in do {...} must be an expression What this means is that the compiler has interpreted the last line of a do

Re: can't find sequence?

2002-10-29 Thread Andrew J Bromage
G'day. On Wed, Oct 30, 2002 at 01:49:37PM +1300, Jason Smith wrote: i.e. TernaryTrie.hs:165: Data constructor not in scope: `M' There is no M in that module anywhere, and I'm pretty sure there never was. Please update your copy from CVS and, if it still isn't working, send a bug report to

Re: library of monadic functions [was: Why no findM ? simple Cat revisited]

2002-11-20 Thread Andrew J Bromage
G'day all. On Wed, Nov 20, 2002 at 08:25:46PM +, Jorge Adriano wrote: I think both versions can be very useful: findM :: (Monad m) = (a - m Bool) - [a] - m (Maybe a) findM' :: (Monad m) = (a - Bool) - [m a] - m (Maybe a) I can also make a case for: findM'' :: (Monad

Re: Random Color

2002-11-20 Thread Andrew J Bromage
G'day all. On Wed, Nov 20, 2002 at 08:44:36PM -0500, Mike T. Machenry wrote: I am trying to construct an infinate list of pairs of random colors. I am hung up on getting a random color. I have: data Color = Blue | Red | Green deriving (Eq, Ord, Show) am I supposed to instantiate a Random

Re: Editor Tab Expansion

2002-12-05 Thread Andrew J Bromage
G'day all. On Thu, Dec 05, 2002 at 09:49:27PM +0100, Ingo Wechsung wrote: I am not going to change my editing habits just to make hugs or ghc happy. What editor do you use? If you use a relatively smart one (e.g. vim, emacs etc), you should be able to configure it to do it to do what you want

Re: Editor Tab Expansion

2002-12-05 Thread Andrew J Bromage
G'day all. On Thu, Dec 05, 2002 at 06:36:22PM -0800, Ashley Yakeley wrote: Haven't we all been through this argument several months ago? I believe the conclusion was people have different preferences, and Haskell allows for that. Sure, but that's a separate issue. My remark was merely in

Re: AW: Editor Tab Expansion

2002-12-07 Thread Andrew J Bromage
G'day all. On Fri, Dec 06, 2002 at 05:40:28PM +0100, Ingo Wechsung wrote: No. It didn't hamper portability with C, Java, Perl or any other *nix stuff since more than 30 years except with COBOL, Python (?) and Haskell, [...] Add to that: Fortran, Occam and Makefiles. There's probably also a

Re: Error Handling

2002-12-08 Thread Andrew J Bromage
G'day all. On Mon, Dec 09, 2002 at 11:35:54AM +1100, Thomas L. Bevan wrote: main = do (a:b:cs) - getArgs i - return (read a :: Int) j - return (read b :: Int) putStr $ i + j How can I catch any possible cast exception? How about this? readM

Re: Error Handling

2002-12-08 Thread Andrew J Bromage
G'day all. Slight correction... On Mon, Dec 09, 2002 at 12:03:03PM +1100, Andrew J Bromage wrote: main = runErrorT main' Of course you need to define an error type and do something with the result of runErrorT, but you get the general idea. Cheers, Andrew Bromage

Re: Ambiguous defaults

2003-01-02 Thread Andrew J Bromage
G'day all. On Thu, Jan 02, 2003 at 05:49:41PM +0100, Ferenc Wagner wrote: What's the way to express the following: a compound object is generally made up of two components with identical type. This should work: \begin{code} module Test where class Component b where property :: b - Int

Re: comonads, io

2003-01-02 Thread Andrew J Bromage
G'day all. On Thu, Jan 02, 2003 at 08:08:20PM -0800, Ashley Yakeley wrote: So is Kieburtz smoking crack, or are we writing OI-style programs incorrectly? I mailed him the example and asked. (I phrased the question a bit differently, though.) One possibility is that comonads are useful for

Re: Problem with backtracking monad transformer

2003-01-30 Thread Andrew J Bromage
G'day all. On Thu, Jan 30, 2003 at 01:55:50PM -, Guest, Simon wrote: I'm trying to make a backtracking state monad using Ralf Hinze's backtracking monad transformer. My problem is that it won't backtrack very far. Suppose I try ( a b ) `mplus` c. If b fails, it should try c, but

Re: Global variables?

2003-02-02 Thread Andrew J Bromage
G'day all. On Fri, Jan 31, 2003 at 09:08:22AM +0100, Ralf Hinze wrote: John Hughes wrote a nice pearl on the subject, see http://www.math.chalmers.se/~rjmh/Globals.ps Nice! Why isn't RefMonad in hslibs? Possibly because of the class signature: class Monad m = RefMonad m r |

  1   2   >