Re: A sample revised prelude for numeric classes

2001-02-12 Thread Bjorn Lisper
Tom Pledger: Brian Boutel writes: : | Having Units as types, with the idea of preventing adding Apples to | Oranges, or Dollars to Roubles, is a venerable idea, but is not in | widespread use in actual programming languages. Why not? There was a pointer to some good papers on this in a

Dimensions of the World (was: A sample revised prelude)

2001-02-12 Thread Jerzy Karczmarczuk
Ashley Yakeley after Tom Pledger: The main complication is that the type system needs to deal with integer exponents of dimensions, if it's to do the job well. Very occasionally non-integer or 'fractal' exponents of dimensions are useful. For instance, geographic coastlines can be

Re: A sample revised prelude for numeric classes

2001-02-12 Thread Ketil Malde
[EMAIL PROTECTED] (Marcin 'Qrczak' Kowalczyk) writes: Why do you stop at allowing addition on Dollars and not include multiplication by a scalar? Perhaps because there is no good universal type for (*). Sorry, it would have to have a different symbol. Is this ubiquitous enough that we

Re: A sample revised prelude for numeric classes

2001-02-12 Thread Jon Fairbairn
On 12 Feb 2001, Ketil Malde wrote: [EMAIL PROTECTED] (Marcin 'Qrczak' Kowalczyk) writes: Why do you stop at allowing addition on Dollars and not include multiplication by a scalar? Perhaps because there is no good universal type for (*). Sorry, it would have to have a different

Re: Scalable and Continuous

2001-02-12 Thread Marcin 'Qrczak' Kowalczyk
On Mon, 12 Feb 2001, Ashley Yakeley wrote: class (Additive a) = Scalable a scale :: Real - a - a -- equivalent to * (not sure of name for Real type) Or times, which would require multiparameter classes. 5 `times` "--" == "--" 5 `times` (\x - x+1) === (\x - x+5) But this

Re: In hoc signo vinces (Was: Revamping the numeric classes)

2001-02-12 Thread William Lee Irwin III
In a later posting Marcin Kowalczyk says: If (+) can be implicitly lifted to functions, then why not signum? Note that I would lift neither signum nor (+). I don't feel the need. ... On Mon, Feb 12, 2001 at 09:33:03AM +, Jerzy Karczmarczuk wrote: I not only feel the need, but I feel

Re: In hoc signo vinces (Was: Revamping the numeric classes)

2001-02-12 Thread Marcin 'Qrczak' Kowalczyk
On Mon, 12 Feb 2001, Jerzy Karczmarczuk wrote: I not only feel the need, but I feel that this is important that the additive structure in the codomain is inherited by functions. It could support only the basic arithmetic. It would not automatically lift an expression which uses () and if. It

Re: In hoc signo vinces (Was: Revamping the numeric classes)

2001-02-12 Thread Marcin 'Qrczak' Kowalczyk
On Mon, 12 Feb 2001, Jerzy Karczmarczuk wrote: I want to be *able* to define mathematical operations upon objects which by their intrinsic nature permit so! You can't do it in Haskell as it stands now, no matter what the Prelude would be. For example I would say that with the definition

Re: A sample revised prelude for numeric classes

2001-02-12 Thread Marcin 'Qrczak' Kowalczyk
Mon, 12 Feb 2001 12:04:39 +0100 (CET), Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] pisze: This is my bet. I changed my mind: class Eq a = PartialOrd a where -- or Ord (), (), (=), (=) :: a - a - Bool -- Minimal definition: () or (=). -- For partial order (=) is

Re: In hoc signo vinces (Was: Revamping the numeric classes)

2001-02-12 Thread Jerzy Karczmarczuk
Marcin Kowalczyk continues: On Mon, 12 Feb 2001, Jerzy Karczmarczuk wrote: I want to be *able* to define mathematical operations upon objects which by their intrinsic nature permit so! You can't do it in Haskell as it stands now, no matter what the Prelude would be. For example I

Clean numeric system?

2001-02-12 Thread Dylan Thurston
On Mon, Feb 12, 2001 at 04:40:06PM +, Jerzy Karczmarczuk wrote: This is the way I program in Clean, where there is no Num, and (+), (*), zero, abs, etc. constitute classes by themselves. ... I've heard Clean mentioned before in this context, but I haven't found the Clean numeric class

Re: A sample revised prelude for numeric classes

2001-02-12 Thread Dylan Thurston
On Mon, Feb 12, 2001 at 07:24:31AM +, Marcin 'Qrczak' Kowalczyk wrote: Sun, 11 Feb 2001 22:27:53 -0500, Dylan Thurston [EMAIL PROTECTED] pisze: Reading this, it occurred to me that you could explictly declare an instance of Powerful Integer Integer and have everything else work. No,

Re: A sample revised prelude for numeric classes

2001-02-12 Thread Dylan Thurston
On Sun, Feb 11, 2001 at 09:17:53PM -0800, William Lee Irwin III wrote: Consider taking of the residue of a truly infinite member of Z[[x]] mod an ideal generated by a polynomial, e.g. 1/(1-x) mod (1+x^2). You can take the residue of each term of 1/(1-x), so x^(2n) - (-1)^n and x^(2n+1) -

Deja vu: Re: In hoc signo vinces (Was: Revamping the numeric classes)

2001-02-12 Thread Laszlo Nemeth
[incomprehensible (not necessarily wrong!) stuff about polynomials, rings, modules over Z and complaints about the current prelude nuked] --- Marcin 'Qrczak' Kowalczyk pisze --- Please show a concrete proposal how Prelude classes could be improved. --- Jerzy Karczmarczuk repondre --- I am

RE: Revamping the numeric HUMAN ATTITUDE

2001-02-12 Thread Simon Peyton-Jones
| I'm seeing a bit of this now, and the error messages GHC spits out | are hilarious! e.g. | | My brain just exploded. | I can't handle pattern bindings for | existentially-quantified constructors. | | and | | Couldn't match `Bool' against `Bool' | Expected type: Bool |