[Haskell-cafe] syntactic anti-unification of TH terms --- best practise?

2008-07-18 Thread Martin Hofmann
I am implementing syntactic anti-unification for TH terms (Exp, Pat, Clause, ...). For example anti-unifying the clauses tail (1:xs) = xs tail (1:2:xs) = (2:xs) would yield tail (1:x1) = x1 whereas the anti-instance of last (1:[]) = 1 last (1:xs) =

Re: [Haskell-cafe] syntactic anti-unification of TH terms --- bestpractise?

2008-07-18 Thread Claus Reinke
Since a term can occur both as a pattern on the left-hand side of the equation and also as expression on the right-hand side, I need to keep track of this, too. So in fact, I have to anti-unify the patterns, 'translate' the resulting state (Data.Map [Pat] Pat) to (Data.Map [Body] Body) and

Re: [Haskell-cafe] syntactic anti-unification of TH terms --- best practice?

2008-07-18 Thread Martin Hofmann
Don't you need to do this translation anyway, because Pat and Exp use different constructors? Yes, somewhere I have to say how to convert Pat to Exp. Perhaps you can reduce some of the lookup cases to looking up just Pat and Exp (eg, looking up in a Body or Clause or Pat or Exp could

Re: [Haskell-cafe] syntactic anti-unification of TH terms --- best practice?

2008-07-18 Thread Nicolas Pouillard
Excerpts from Martin Hofmann's message of Fri Jul 18 12:01:28 +0200 2008: Don't you need to do this translation anyway, because Pat and Exp use different constructors? Yes, somewhere I have to say how to convert Pat to Exp. That's often doable, but you have to deal with patterns like

Re: [Haskell-cafe] Data.Complex.magnitude slow?

2008-07-18 Thread stefan kersten
On 17.07.2008, at 21:46, Lennart Augustsson wrote: If scaleFloat and exponent are implemented with bit twiddling they can be quite fast. is there a way in ghc to 'cast' between float/int32 and double/int64 (without going through memory)? sk ___

Re: [Haskell-cafe] Data.Complex.magnitude slow?

2008-07-18 Thread stefan kersten
On 18.07.2008, at 13:05, Henning Thielemann wrote: On Fri, 18 Jul 2008, stefan kersten wrote: On 17.07.2008, at 21:46, Lennart Augustsson wrote: If scaleFloat and exponent are implemented with bit twiddling they can be quite fast. is there a way in ghc to 'cast' between float/int32 and

Re: [Haskell-cafe] Data.Complex.magnitude slow?

2008-07-18 Thread Henning Thielemann
On Fri, 18 Jul 2008, stefan kersten wrote: On 17.07.2008, at 21:46, Lennart Augustsson wrote: If scaleFloat and exponent are implemented with bit twiddling they can be quite fast. is there a way in ghc to 'cast' between float/int32 and double/int64 (without going through memory)? What

Re: [Haskell-cafe] Profiling nested case

2008-07-18 Thread Mitar
Hi! On Sat, Jul 12, 2008 at 3:33 AM, Max Bolingbroke [EMAIL PROTECTED] wrote: If findColor had been a function defined in terms of foldr rather than using explicit recursion, then theres a good chance GHC 6.9 would have fused it with the list to yield your optimized, loop unrolled, version:

Re: [Haskell-cafe] Data.Complex.magnitude slow?

2008-07-18 Thread Henning Thielemann
On Fri, 18 Jul 2008, stefan kersten wrote: for implementing scaleFloat and exponent on the bitlevel as lennart suggested, it would be preferable if the cast would be compiled to a register move/reinterpretation, rather than a store/load through several layers of abstraction (such as

Re: [Haskell-cafe] Data.Complex.magnitude slow?

2008-07-18 Thread Ian Lynagh
On Thu, Jul 17, 2008 at 06:56:52PM +0200, stefan kersten wrote: c_magnitude0 (Complex.Data.magnitude) 0m7.249s c_magnitude1 (non-scaling version) 0m1.176s c_magnitude2 (scaling version, strict square) 0m3.278s Thanks! I've filed a bug here:

Re: [Haskell-cafe] Profiling nested case

2008-07-18 Thread Chaddaï Fouché
2008/7/12 Mitar [EMAIL PROTECTED]: So that I can easily change the type everywhere. But it would be much nicer to write: data Quaternion a = Q !a !a !a !a deriving (Eq,Show) Only the performance of Num instance functions of Quaternion is then quite worse. You can probably use a

Re: [Haskell-cafe] Profiling nested case

2008-07-18 Thread Mitar
Hi! On Fri, Jul 18, 2008 at 3:54 PM, Chaddaï Fouché [EMAIL PROTECTED] wrote: So that I can easily change the type everywhere. But it would be much nicer to write: data Quaternion a = Q !a !a !a !a deriving (Eq,Show) Only the performance of Num instance functions of Quaternion is then quite

Re: [Haskell-cafe] Data.Complex.magnitude slow?

2008-07-18 Thread Don Stewart
sk: On 17.07.2008, at 21:46, Lennart Augustsson wrote: If scaleFloat and exponent are implemented with bit twiddling they can be quite fast. is there a way in ghc to 'cast' between float/int32 and double/int64 (without going through memory)? Yeah, fromIntegral/Int-Float

Re: [Haskell-cafe] Data.Complex.magnitude slow?

2008-07-18 Thread stefan kersten
On 18.07.2008, at 19:47, Don Stewart wrote: sk: On 17.07.2008, at 21:46, Lennart Augustsson wrote: If scaleFloat and exponent are implemented with bit twiddling they can be quite fast. is there a way in ghc to 'cast' between float/int32 and double/int64 (without going through memory)?

Re: [Haskell-cafe] Data.Complex.magnitude slow?

2008-07-18 Thread Don Stewart
sk: On 18.07.2008, at 19:47, Don Stewart wrote: sk: On 17.07.2008, at 21:46, Lennart Augustsson wrote: If scaleFloat and exponent are implemented with bit twiddling they can be quite fast. is there a way in ghc to 'cast' between float/int32 and double/int64 (without going through

[Haskell-cafe] FFI C Structs

2008-07-18 Thread Aleš Bizjak
Hello, Suppose I have a C struct like typedef { int a; int *b; } Foo; typedef Foo *fooptr; and all worker functions which are all basically int foofun (fooptr , fooptr, fooptr) where the first one is a out argument and the other two are in arguments and the return value is

Re: [Haskell-cafe] Profiling nested case

2008-07-18 Thread Max Bolingbroke
2008/7/18 Mitar [EMAIL PROTECTED]: On Sat, Jul 12, 2008 at 3:33 AM, Max Bolingbroke [EMAIL PROTECTED] wrote: If findColor had been a function defined in terms of foldr rather than using explicit recursion, then theres a good chance GHC 6.9 would have fused it with the list to yield your

[Haskell-cafe] Re: Profiling nested case

2008-07-18 Thread Ben Franksen
Mitar wrote: On Fri, Jul 18, 2008 at 3:54 PM, Chaddaï Fouché [EMAIL PROTECTED] wrote: So that I can easily change the type everywhere. But it would be much nicer to write: data Quaternion a = Q !a !a !a !a deriving (Eq,Show) Only the performance of Num instance functions of Quaternion is

Re: [Haskell-cafe] Re: Profiling nested case

2008-07-18 Thread Don Stewart
ben.franksen: Mitar wrote: On Fri, Jul 18, 2008 at 3:54 PM, Chaddaï Fouché [EMAIL PROTECTED] wrote: So that I can easily change the type everywhere. But it would be much nicer to write: data Quaternion a = Q !a !a !a !a deriving (Eq,Show) Only the performance of Num instance

[Haskell-cafe] Re: Trying to install cabal

2008-07-18 Thread Ben Franksen
Henning Thielemann wrote: On Mon, 14 Jul 2008, Tillmann Rendel wrote: Apropos cabal-install: can i make it build documentation during the installation process and store them in some central location? I also wondered about that. Maybe a '--haddock' flag for 'cabal install' ? Everyone seems

[Haskell-cafe] Help using Network.Curl

2008-07-18 Thread Jim Burton
I want to convert this code (a Hello World with the ebay API) to the curl binding in the hope that it will handle SSL and redirections etc better. Can someone give me some pointers please, or a link to an example? I haven't used libcurl or Network.Curl and can't find anything helpful...Thanks!

[Haskell-cafe] Fwd: NW Functional Programming Interest Group

2008-07-18 Thread Greg Meredith
All, Apologies for multiple listings. This is just a friendly reminder to Northwest functionally minded folks that this month's meeting is to be held The Seattle Public Library 5009 Roosevelt Way N.E. Seattle, WA 98105 206-684-4063 from 18.30 - 19:45 on July 23rd. We'll be getting a demo of a