[Haskell-cafe] Re: coherence when overlapping?

2006-04-13 Thread william kim
Thank you oleg. Sulzmann et al use guards in CHR to turn overlapping heads (instances) into non-overlapping. Their coherence theorem still assumes non-overlapping. I agree that what you described is the desirable behaviour when overlapping, that is to defer the decision when multiple

[Haskell-cafe] Re: coherence when overlapping?

2006-04-13 Thread Martin Sulzmann
Coherence (roughly) means that the program's semantics is independent of the program's typing. In case of your example below, I could type the program either use the first or the second instance (assuming g has type Int-Int). That's clearly bound. Guard constraints enforce that instances are

Re: [Haskell-cafe] Re: coherence when overlapping?

2006-04-13 Thread Martin Sulzmann
I believe that GHC's overlapping instance extensions effectively uses inequalities. Why do you think that 'inequalities' model 'best-fit'? instance C Int -- (1) instance C a-- (2) under a 'best-fit' instance reduction strategy we would resolve C a by using (2). 'best-fit' should

RE: [Haskell-cafe] Re: coherence when overlapping?

2006-04-13 Thread Simon Peyton-Jones
| I believe that GHC's overlapping instance extensions | effectively uses inequalities. I tried to write down GHC's rules in the manual: http://haskell.org/ghc/dist/current/docs/users_guide/type-extensions.htm l#instance-decls The short summary is: - find candidate instances that match - if

RE: [Haskell-cafe] Re: coherence when overlapping?

2006-04-13 Thread william kim
Thank you Martin. Coherence (roughly) means that the program's semantics is independent of the program's typing. In case of your example below, I could type the program either use the first or the second instance (assuming g has type Int-Int). That's clearly bound. If g has type Int-Int, it

[Haskell-cafe] Re: coherence when overlapping?

2006-04-13 Thread oleg
It seems that the subject is a bit more complex, and one can force GHC to choose the less specific instance (if one confuses GHC well enough): see the example below. First of all, the inequality constraint is already achievable in Haskell now: TypeEq t1 t2 False is such a constraint. One can

Re: [Haskell-cafe] Re: coherence when overlapping?

2006-04-13 Thread Claus Reinke
one can force GHC to choose the less specific instance (if one confuses GHC well enough): see the example below. your second example doesn't really do that, though it may look that way. class D a b | a - b where g :: a - b instance D Int Bool where g x = True instance TypeCast Int b = D a b

Re: [Haskell-cafe] The Marriage of Heaven and Hell: Type Classes and Bit-Twiddling

2006-04-13 Thread David F. Place
Sorry to respond to my own message, but I found a much more satisfactory way to solve this problem. ghc is able to specialize it so that data Test1 = Foo | Bar | Baaz | Quux deriving (Enum, Bounded) sizeTest1 :: (Set Test1) - Int sizeTest1 = sizeB compiles into a call directly to

Re[2]: [Haskell-cafe] Counting bits: Sanity Check

2006-04-13 Thread Bulat Ziganshin
Hello David, Thursday, April 13, 2006, 12:55:05 AM, you wrote: Yes, especially curious since the algorithm is taken from AMD's optimization guide for the Athlon and Opteron series. I'm not good enough at reading core syntax to be able to see what GHC is doing with it. optimization for

[Haskell-cafe] Re: Fundeps: I feel dumb

2006-04-13 Thread Creighton Hogg
On 13 Apr 2006 03:27:03 -, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Creighton Hogg wrote: No instance for (MatrixProduct a (Vec b) c) arising from use of `*' at interactive:1:3-5 Probable fix: add an instance declaration for (MatrixProduct a (Vec b) c) In

[Haskell-cafe] Re: coherence when overlapping?

2006-04-13 Thread Aaron Denney
On 2006-04-13, Martin Sulzmann [EMAIL PROTECTED] wrote: I believe that GHC's overlapping instance extensions effectively uses inequalities. Why do you think that 'inequalities' model 'best-fit'? instance C Int -- (1) instance C a-- (2) under a 'best-fit' instance reduction

[Haskell-cafe] #if and #endif

2006-04-13 Thread ihope
I grabbed the source code to Haddock, but GHC doesn't like the #if's and the #endif's. What can I do with these? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] #if and #endif

2006-04-13 Thread ihope
On 4/13/06, Jason Dagit [EMAIL PROTECTED] wrote: Try using passing -cpp to ghc when you compile. Jason Thanks. Will do. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Local Fundeps [was: Fundeps: I feel dumb]

2006-04-13 Thread oleg
Creighton Hogg posed the following problem. Given a rather straightforward matrix multiplication code -- The elements and the size data Vec a = Vec (Array Int a) Int deriving (Show,Eq) type Matrix a = (Vec (Vec a)) class MatrixProduct a b c | a b - c where (*) :: a - b - c instance

[Haskell-cafe] RuntimeLoader

2006-04-13 Thread Tim Newsham
Hi, I'm about to start playing with HWS-WP (web server + plugins). It relies on RuntimeLoader: http://www.algorithm.com.au/wiki/hacking/haskell.ghc_runtime_loading I grabbed the example and built it (only one minor tweak to imports to get it to build) but it doesnt quite work: $