Re: [Haskell-cafe] Linker problems linking FFI import call in Windows

2008-07-17 Thread Olivier Boudry
On Wed, Jul 16, 2008 at 6:22 PM, PJ Durai [EMAIL PROTECTED] wrote: I do have the import library. It came with the DLL. It links properly when I use CCALL on the haskell import statements. Doesnt link when I use STDCALL. It looks for function name with something like '@4 or @8' tacked on at

Re: [Haskell-cafe] FFI and struct arguments

2008-07-17 Thread kyra
Felipe Lessa wrote: Hi, I tried googling and searching the haskellwiki about this but wasn't lucky enough. My question is: is there a way to send struct arguments to C functions via the FFI or do I need to create a C wrapper? I guess there isn't, and while I can live without it, I'd like to

[Haskell-cafe] Re: Fixed-Point Combinators

2008-07-17 Thread Jon Fairbairn
Adrian Neumann [EMAIL PROTECTED] writes: Hello, while studying for a exam I came across this little pearl: Y = (L L L L L L L L L L L L L L L L L L L L L L L L L L L L) where L = λabcdefghijklmnopqstuvwxyzr. (r (t h i s i s a f i x e d p o i n t c o m b i n a t o r)) posted by Cale

Re: [Haskell-cafe] Type level sets with GADTs, fundeps etc

2008-07-17 Thread J . Burton
At Tue, 15 Jul 2008 10:27:59 -0400, Jeff Polakow wrote: [1 text/plain; US-ASCII (7bit)] [2 text/html; US-ASCII (7bit)] Hello, data LSet t where Nil :: LSet Nil Ins :: (Member a t b , If b t (a ::: t) r) = L a - LSet t - LSet r Try replacing both

[Haskell-cafe] Searchig for modules

2008-07-17 Thread fero
Hi I am learnig Haskell form SOE book, but I can't find out how to import SOE module. I use eclipsefp IDE and I get no error when I have SOE.hs in my project and in SimpleGraphics.hs I make import SOE. But when trying to run it I get error: Could not find module `SOE': Use -v to see a list of the

Re: [Haskell-cafe] Searchig for modules

2008-07-17 Thread fero
Actually I have already found the way how to do it but not in eclipsefp. Either I run ghci and when both modules are in the same dir it works or I use -idirs but in eclipsefp it doesn't. Can somebody help me how to configure eclipsefp. I don't want to go to command prompt every time I want to run

Re: [Haskell-cafe] FFI and struct arguments

2008-07-17 Thread Duncan Coutts
On Wed, 2008-07-16 at 22:45 -0300, Felipe Lessa wrote: Hi, I tried googling and searching the haskellwiki about this but wasn't lucky enough. My question is: is there a way to send struct arguments to C functions via the FFI or do I need to create a C wrapper? I guess there isn't, and

Re: [Haskell-cafe] Searchig for modules

2008-07-17 Thread Isaac Dupree
fero wrote: Actually I have already found the way how to do it but not in eclipsefp. Either I run ghci and when both modules are in the same dir it works or I use -idirs but in eclipsefp it doesn't. Can somebody help me how to configure eclipsefp. I don't want to go to command prompt every time

Re: [Haskell-cafe] Searchig for modules

2008-07-17 Thread frantisek kocun
It works when I put -idirs c:\eworkspace2\Soe\src\SOE to extra compiler options and set GHCi to use GHC setting, but you need to restart ecpilse. And the module, wht is loaded is SOE so I always need to switch module.. Fero On Thu, Jul 17, 2008 at 1:18 PM, fero [EMAIL PROTECTED] wrote:

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

2008-07-17 Thread stefan kersten
hi, i've attached an example program which seems to indicate that the magnitude function from Data.Complex is very slow compared to a more naive implementation (for Complex Float). on my machine (intel core2 duo, osx 10.4) the CPU time using the library function is about 6-7 times as

Re: [Haskell-cafe] FFI and struct arguments

2008-07-17 Thread kyra
If the struct is passed by reference of course then you're fine, but if it's by value then you need a C wrapper. The reason is because it's beyond the scope of the FFI to know the structure layout and how to map that to haskell types. That's the domain of FFI pre-processors. However I don't know

Re: [Haskell-cafe] Type level sets with GADTs, fundeps etc

2008-07-17 Thread Jeff Polakow
Hello, Thanks. This sort of works, but shifts the problem to another context. Now it seems that I can't hide the extra type information in the existential types, which is what I want to do. I think that you can't abstract over a type context, i.e. you can't expect type inference to

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

2008-07-17 Thread Henning Thielemann
On Thu, 17 Jul 2008, stefan kersten wrote: i've attached an example program which seems to indicate that the magnitude function from Data.Complex is very slow compared to a more naive implementation (for Complex Float). on my machine (intel core2 duo, osx 10.4) the CPU time using the library

RE: [Haskell-cafe] FFI and struct arguments

2008-07-17 Thread Bayley, Alistair
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Duncan Coutts Sent: 17 July 2008 12:46 On Wed, 2008-07-16 at 22:45 -0300, Felipe Lessa wrote: Hi, I tried googling and searching the haskellwiki about this but wasn't lucky enough. My question is: is there a way to send

Re: [Haskell-cafe] uvector and the stream interface

2008-07-17 Thread Evan Laforge
An abstraction stack: Impure Pure How about strict vs. lazy? I ask because I assumed there were lazy variants of uvector or storablevector, using the bytestring list of chunks approach, but apparently not? Making a lazy version seems pretty easy, but rewriting all the basic

Re: [Haskell-cafe] uvector and the stream interface

2008-07-17 Thread Henning Thielemann
On Thu, 17 Jul 2008, Evan Laforge wrote: An abstraction stack: Impure Pure How about strict vs. lazy? I ask because I assumed there were lazy variants of uvector or storablevector, using the bytestring list of chunks approach, but apparently not? For storablevector there

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

2008-07-17 Thread Ian Lynagh
On Thu, Jul 17, 2008 at 05:18:01PM +0200, Henning Thielemann wrote: On Thu, 17 Jul 2008, stefan kersten wrote: i've attached an example program which seems to indicate that the magnitude function from Data.Complex is very slow compared to a more naive implementation (for Complex Float).

Re: [Haskell-cafe] FFI and struct arguments

2008-07-17 Thread Felipe Lessa
On Thu, Jul 17, 2008 at 12:08 PM, kyra [EMAIL PROTECTED] wrote: Yes, but programmer *knows* the structure layout, so she usually can emulate it with a sequence of primary ffi type arguments. It's pretty trivial for the original example (see my previous post on this subj) and can be extended

Re: [Haskell-cafe] FFI and struct arguments

2008-07-17 Thread Felipe Lessa
On Thu, Jul 17, 2008 at 12:37 PM, Bayley, Alistair [EMAIL PROTECTED] wrote: -- inline your *vect-vect wrapper (ends up in generated .c file) #def void funcWrapper(vect *v) { func(*v); } foreign import stdcall funcWr unsafe funcWrapper :: VectorC - IO () I am using hsc2hs currently, but

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

2008-07-17 Thread stefan kersten
On 17.07.2008, at 17:42, Ian Lynagh wrote: On Thu, Jul 17, 2008 at 05:18:01PM +0200, Henning Thielemann wrote: Complex.magnitude must prevent overflows, that is, if you just square 1e200::Double you get an overflow, although the end result may be also around 1e200. I guess, that to this end

Re: [Haskell-cafe] uvector and the stream interface

2008-07-17 Thread Isaac Dupree
Evan Laforge wrote: An abstraction stack: Impure Pure How about strict vs. lazy? I ask because I assumed there were lazy variants of uvector or storablevector, using the bytestring list of chunks approach, but apparently not? wait list of chunks makes something that

[Haskell-cafe] Space leaks

2008-07-17 Thread Peter Gavin
Hello everyone, I have this piece of code I've been working on, and I've been stuck on tracking down a space leak in it for some time now. The code is essentially a tight loop that updates a rather largish data structure with embedded functions that are called by the driver loop. The code

Re: [Haskell-cafe] Space leaks

2008-07-17 Thread Luke Palmer
On Thu, Jul 17, 2008 at 12:14 PM, Peter Gavin [EMAIL PROTECTED] wrote: Hello everyone, I have this piece of code I've been working on, and I've been stuck on tracking down a space leak in it for some time now. The code is essentially a tight loop that updates a rather largish data structure

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

2008-07-17 Thread stefan kersten
On 17.07.2008, at 17:18, Henning Thielemann wrote: i've attached an example program which seems to indicate that the magnitude function from Data.Complex is very slow compared to a more naive implementation (for Complex Float). on my machine (intel core2 duo, osx 10.4) the CPU time using

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

2008-07-17 Thread Lennart Augustsson
If scaleFloat and exponent are implemented with bit twiddling they can be quite fast. I have a feeling that they involve slow FFI calls in GHC (being the original author of a lot of the code involved). On Thu, Jul 17, 2008 at 8:21 PM, stefan kersten [EMAIL PROTECTED] wrote: On 17.07.2008, at

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

2008-07-17 Thread Henning Thielemann
On Thu, 17 Jul 2008, Ian Lynagh wrote: On Thu, Jul 17, 2008 at 05:18:01PM +0200, Henning Thielemann wrote: Complex.magnitude must prevent overflows, that is, if you just square 1e200::Double you get an overflow, although the end result may be also around 1e200. I guess, that to this end

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

2008-07-17 Thread Henning Thielemann
On Thu, 17 Jul 2008, stefan kersten wrote: On 17.07.2008, at 17:18, Henning Thielemann wrote: i've attached an example program which seems to indicate that the magnitude function from Data.Complex is very slow compared to a more naive implementation (for Complex Float). on my machine (intel

Re: [Haskell-cafe] Space leaks

2008-07-17 Thread Jefferson Heard
Peter, from 500 feet, we can't see much, but your strictness might actually be your problem depending on what largish looks like and whether you're reading your data from disc. It's entirely possible that your data structure updates or disc reads are head-strict and you're evaluating or loading

Re: [Haskell-cafe] Space leaks

2008-07-17 Thread Justin Bailey
On Thu, Jul 17, 2008 at 11:14 AM, Peter Gavin [EMAIL PROTECTED] wrote: evaluated anywhere. I've used retainer profiling, and the functions that are leaking space according to the profiler output are strict throughout. Have you looked at the Core code generated? That might show something that

Re: [Haskell-cafe] FFI and struct arguments

2008-07-17 Thread Magnus Therning
Felipe Lessa wrote: Hi, I tried googling and searching the haskellwiki about this but wasn't lucky enough. My question is: is there a way to send struct arguments to C functions via the FFI or do I need to create a C wrapper? I guess there isn't, and while I can live without it, I'd like to

Re: [Haskell-cafe] FFI and struct arguments

2008-07-17 Thread Duncan Coutts
On Thu, 2008-07-17 at 13:36 -0300, Felipe Lessa wrote: I am using hsc2hs currently, but googling about #def with Cabal I found out that some people were having trouble to make Cabal discover that hsc2hs had created a new C file. Specifically, bug #245 [1] which says that the milestone is

Re: [Haskell-cafe] Space leaks

2008-07-17 Thread Peter Gavin
Thanks for the responses. This is basically what I've got looks like (grossly simplified): data Monad m = Foo m a b = Foo { action :: m (Foo m a b, b) , update :: a - Foo m a b } The driver loop injects new values with update, and executes action whenever it's ready to,

Re: [Haskell-cafe] Space leaks

2008-07-17 Thread Peter Gavin
Replying to myself... Interesting. I removed all the bangs other than the obvious loop variables, and all the uses of seq that I had inserted, and there's still no leak. Does anyone know why the leak would disappear when GHC is using IO other than a generic (unspecified) monad? Is there