[Haskell-cafe] Performance Issue

2010-05-18 Thread Richard Warburton
A colleague of mine pointed out that ghc wasn't performing as he expected when optimising some code. I wonder if anyone could offer any insight as to why its not noting this common subexpression: main = print $ newton 4 24 newton a 0 = a newton a n = ((newton a (n-1))^2 + a)/(2*(newton a

Re: [Haskell-cafe] Performance Issue

2010-05-18 Thread Richard Warburton
A colleague of mine pointed out that ghc wasn't performing as he expected when optimising some code.  I wonder if anyone could offer any insight as to why its not noting this common subexpression: GHC performs almost no common subexpression elimination, the reasons being that it can

[Haskell-cafe] Dynamically Linking Foreign Functions

2009-12-31 Thread Richard Warburton
the loading function - obviously I can give it a CString for the library, and another for the function in question - but what would the return type be? regards, Richard Warburton ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org

Re: [Haskell-cafe] Dynamically Linking Foreign Functions

2009-12-31 Thread Richard Warburton
Problem: I don't understand how I can generate the foreign import statements at runtime. there are special C libraries that doest it. one of them is libffi, another one (can't recall its name) is used by ghc itself. libffi isn't x64-compatible, unlike second one Thanks a lot. Though the