[Haskell] strange behavior of Implicit Parameters

2006-02-26 Thread Eike Scholz
Hi, I have just a short question, about the semantics of Implicit parameters on GHC 6.4. Given the following code: (???) x f = let ?foo = 1337 in f x fun :: (?foo::Int,Show x) = x - String fun x = x = ++(show x)++; ?foo = ++(show ?foo) test = let ?foo = 23 in 42 ???

[Haskell] Haskell Weekly News: February 27, 2006

2006-02-26 Thread Donald Bruce Stewart
Haskell Weekly News: February 27, 2006 Greetings, and thanks for reading issue 26 of HWN, a weekly newsletter covering developments in the Haskell community. Each Monday, new editions are posted to [1]the Haskell mailing list and to [2]The Haskell Sequence. [3]RSS

How to bind a window library (in C) to Haskell?

2006-02-26 Thread Brian Hulley
Hi - I'd like to be able to use Haskell for the project I'm working on but the problem is that I've already written a lot of code for a nice GUI using DirectX in Visual C++. I thought it might be possible to make up some kind of simple API for it which I could call from Haskell, so I started

Re: How to bind a window library (in C) to Haskell?

2006-02-26 Thread Esa Ilari Vuokko
On 2/27/06, Brian Hulley [EMAIL PROTECTED] wrote: Hi [snip] 1) Does this mean that the FFI can only pass Int, Char etc and not user defined data types or compound data types? Yes. The idea is that instead of pointers/references you have Ptr a, and instance Storable a that provides marshalling

[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 =

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

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

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] (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 probably misunderstanding