Shared Libraries in ghci

2008-02-08 Thread Bernd Brassel
Sorry to ask a C question here, but I could not find an answer on the net. How do I create a library that can be used in ghci? This is the situation: I have a c file coracle.c. I do /tmp$ cc -c -o coracle.o coracle.c /tmp$ ar rc libcoracle.a coracle.o /tmp$ ranlib libcoracle.a and then I the

RE: Shared Libraries in ghci

2008-02-08 Thread Simon Peyton-Jones
Any chance of documenting your experience on the GHC user documentation page? http://haskell.org/haskellwiki/GHC (under collaborative documentation) A kind of how-to that worked for you, with pointers to relevant manual parts etc. Simon | -Original Message- | From: [EMAIL

Re: What does unsafePerformIO do to the stack

2008-02-08 Thread Bernd Brassel
Simon Marlow wrote: Perhaps there are some trivial examples of unshared thunks that we could spot, though. The sharing analysis in the interpreter is also very simple and inexpensive. But the gain is frequent. Maybe giving it a try would be worthwhile. Thanks again for all your answers! Bernd

Re: Shared Libraries in ghci

2008-02-08 Thread Bernd Brassel
Simon Marlow wrote: Normally it's done like this: $ gcc -fPIC -c foo.c $ gcc -shared -o libfoo.so foo.o Hope this helps. Right away! Big Thanks! Bernd ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org

Re: Shared Libraries in ghci

2008-02-08 Thread Simon Marlow
Bernd Brassel wrote: Sorry to ask a C question here, but I could not find an answer on the net. How do I create a library that can be used in ghci? This is the situation: I have a c file coracle.c. I do /tmp$ cc -c -o coracle.o coracle.c /tmp$ ar rc libcoracle.a coracle.o /tmp$ ranlib

Re: What does unsafePerformIO do to the stack

2008-02-08 Thread Simon Marlow
Bernd Brassel wrote: There is another point that makes me wonder now. If the update frame for the recursive call is the problem then my solution with foreign C functions would produce a bad stack also. But this is not the case. The code looks now like this: sim [] = True sim (_:xs) = yags

Array.ST is not being nice to me

2008-02-08 Thread Robert van Herk
Hi all, I have a problem with regards to the speed of ST arrays. In short: a Data.Map.Map outperforms Data.Array.ST in my application, whereas as far as I understand it, the ST array should be quicker. My application is a compiler. It compiles some source code into a (huge) number of boolean

Re: Array.ST is not being nice to me

2008-02-08 Thread Chris Kuklewicz
So my theory now is: I do a large number of lookups. Try using Data.Array.Base.unsafeRead (and maybe ata.Array.Base.unsafeWrite). These avoid the bounds checking on the index each time you lookup something in the array. ___ Glasgow-haskell-users

Re: Array.ST is not being nice to me

2008-02-08 Thread Simon Marlow
Chris Kuklewicz wrote: So my theory now is: I do a large number of lookups. Try using Data.Array.Base.unsafeRead (and maybe ata.Array.Base.unsafeWrite). These avoid the bounds checking on the index each time you lookup something in the array. Right. Also keep an eye on the GC time

Re: Shared Libraries in ghci

2008-02-08 Thread Bernd Brassel
Simon Peyton-Jones wrote: Any chance of documenting your experience on the GHC user documentation page? http://haskell.org/haskellwiki/GHC (under collaborative documentation) A kind of how-to that worked for you, with pointers to relevant manual parts etc. Simon Is this