Re: [Haskell-cafe] (Un)termination of overloading resolution

2006-02-26 Thread Roman Leshchinskiy
On Mon, 27 Feb 2006, Martin Sulzmann wrote: > > In case we have an n-ary type function T > > (or (n+1)-ary type class constraint T) > > the conditions says > > for each > > > > type T t1 ... tn = t > > > > (or rule T t1 ... tn x ==> t) > > > > then rank(ti) > rank(t) for each i=1,..,n > > I'm pro

Re: [Haskell-cafe] (Un)termination of overloading resolution

2006-02-26 Thread Martin Sulzmann
The following not only answers Roman's question but also includes a short summary (at the end) of the discussion we had so far. Roman Leshchinskiy writes: > On Wed, 2006-02-22 at 12:33 +0800, Martin Sulzmann wrote: > > In case we have an n-ary type function T > > (or (n+1)-ary type class cons

Re: [Haskell-cafe] rounding errors with real numbers.

2006-02-26 Thread Brian Hulley
Matthias Fischmann wrote: | -- fix rounding error: | repair [i] = [upper] | repair (h:t) = h : repair t Just to point out that this only fixes the last element of the list, so inputs like [1,2,10.8,10.8] would not be handled properly if you require the same input values to map to

Re: [Haskell-cafe] rounding errors with real numbers.

2006-02-26 Thread Jared Updike
> Well, if you are relying on exact results from floating point > arithmetic you're in trouble no matter what you do. As long as you don't do anything irrational (exp, sin, sqrt, etc.), you should be able to get away with using Rational. Number constants with decimals are not automatically constru

Re: [Haskell-cafe] Question about Haskell types

2006-02-26 Thread Brian Hulley
Neil Mitchell wrote: Hi Pete, a = (<) b x = (x <) c x y = (x < y) I'm pretty sure this is the Monomorphism Restriction, its on the wiki at: http://www.haskell.org/hawiki/MonomorphismRestriction You can use ghc -fno-monomorphism-restriction to compile the above or alternatively give a type

[Haskell-cafe] [Solved] rounding errors with real numbers.

2006-02-26 Thread Matthias Fischmann
On Sun, Feb 26, 2006 at 01:00:54PM +, Chris Kuklewicz wrote: > To: Matthias Fischmann <[EMAIL PROTECTED]> > Cc: haskell-cafe@haskell.org > From: Chris Kuklewicz <[EMAIL PROTECTED]> > Date: Sun, 26 Feb 2006 13:00:54 + > Subject: Re: [Haskell-cafe] rounding errors with real numbers. > > You

Re: [Haskell-cafe] rounding errors with real numbers.

2006-02-26 Thread Lennart Augustsson
Well, if you are relying on exact results from floating point arithmetic you're in trouble no matter what you do. I would just ignore the slight error and when finally printing the results do some rounding. Trying to fudge things is just going to bite you somewhere else. (BTW, I much prefer the

Re: [Haskell-cafe] Question about Haskell types

2006-02-26 Thread Neil Mitchell
Hi Pete, > a = (<) > b x = (x <) > c x y = (x < y) I'm pretty sure this is the Monomorphism Restriction, its on the wiki at: http://www.haskell.org/hawiki/MonomorphismRestriction Thanks Neil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http:

[Haskell-cafe] Question about Haskell types

2006-02-26 Thread Pete Chown
I've been trying to get to the point with Haskell where I can write useful programs, and I've come across something I don't understand with the type system. I hope this is the right place to ask. I came up with the following list of declarations: a = (<) b x = (x <) c x y = (x < y) It turns

Re: [Haskell-cafe] rounding errors with real numbers.

2006-02-26 Thread Chris Kuklewicz
Your solution works, but is slightly wasteful with (repair) traversing the whole list again. Here is a slightly more efficient expression: -- Precondition: The first parameter (xs) is sorted (ascending) : -- assert (all (zipWith (<=) (xs, tail xs))) -- low' < high' -

[Haskell-cafe] rounding errors with real numbers.

2006-02-26 Thread Matthias Fischmann
hi, I think this is the well-known issue of using real numbers in decimal representation on a machine that thinks binary, but I don't know what to do with it, and some of you maybe do. I want to shift+stretch a list of doubles into a given interval. example: | x1 = [2, 3, 4, 5, 10] | y1 = norm