Re: Array.ST is not being nice to me

2008-02-09 Thread Robert van Herk
Hi all, 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 (+RTS

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

[Haskell-cafe] Master's thesis project at Philips Research

2007-07-19 Thread Robert van Herk
hardware - is a good “team-player” - can express himself well in English Of course, affinity with story designing or toy designing is advantageous. Please contact me by e-mail if you are interested! Regards, Robert - Robert van Herk Research Scientist, IT Group, Philips

Idempontent IO actions and unsafeSTMToIO

2005-08-06 Thread Robert van Herk
Hi all, Is it true to say that to perform idempotent IO actions inside a STM monad by using unsafeSTMToIO is safe? I mean something like: do ... -- some STM actions unsafeSTMToIO a -- Here, a is an idempotent IO action ... -- some other STM actions What I read from the various

STM and unsafePerformIO

2005-08-03 Thread Robert van Herk
Hello All, I think I've read somewhere that STM doesn't like unsafePerformIO. However, I would like to use a global STM variable. Something like this: *module* Main *where* import GHC.Conc import System.IO.Unsafe tSid = unsafePerformIO (atomically (newTVar 0)) tickSessionID :: STM Int

Re: STM and unsafePerformIO

2005-08-03 Thread Robert van Herk
Never mind, I can probably use an MVar to work around this... Robert Robert van Herk wrote: Hello All, I think I've read somewhere that STM doesn't like unsafePerformIO. However, I would like to use a global STM variable. Something like this: module Main where import GHC.Conc import

Re: STM and unsafePerformIO

2005-08-03 Thread Robert van Herk
Oh I see! Your sollutions are indeed a lot better than implementating all my code using MVars :-). Thanks, Robert Remi Turk wrote: On Wed, Aug 03, 2005 at 12:50:54PM +0200, Robert van Herk wrote: Hello All, I think I've read somewhere that STM doesn't like unsafePerformIO. However, I

When to run the garbage collector

2005-06-14 Thread Robert van Herk
Hello, I noticed that it is possible to run the garbage collector explicitely... Currently, I am writing a stateful webserver, that once in a while (e.g. every 30 minutes) can discard a lot of memory (because every 30 minutes sessions time out and their state can be thrown away). Would it

Re: GHC hang

2005-06-06 Thread Robert van Herk
John Goerzen wrote: On 2005-06-06, Simon Peyton-Jones [EMAIL PROTECTED] wrote: Lots of people seem to have had problems compiling Wash with GHC 6.4. Another person told me, perhaps in private, that it just takes GHC 15 minutes to compile the specific file in question on amd64. It

Re: Contexts differ in length

2005-05-27 Thread Robert van Herk
Simon Peyton-Jones wrote: | A while ago I sent an email to the glasgow haskell users maillinglist to | explain how the Contexts differ in length feature (or bug :-)) | restricted me in writing a haskell application. I was hoping for a | reply, however I didn't receive one (yet). It's a

Contexts differ in length

2005-05-24 Thread Robert van Herk
Hi all, A while ago I sent an email to the glasgow haskell users maillinglist to explain how the Contexts differ in length feature (or bug :-)) restricted me in writing a haskell application. I was hoping for a reply, however I didn't receive one (yet). Therefore, I will explain the problem

IO and STM

2005-04-13 Thread Robert van Herk
Hi all, I have a question about IO in a STM transaction. I want to make an atomic algorithm that does the following: 1. read an IORef 2. write some changes to the value you get from 1 3. save the IORef again Currently, I did this, roughly like this: doSomething :: IORef [s] - s - IO () doSomething

Re: IO and STM

2005-04-13 Thread Robert van Herk
You probably wanna use TVars instead of IORefs. I would suggest reading the STM paper at research.microsoft.com/~simonpj/papers/stm/stm.ps, if you haven't already. ah, I read about them, and than forgot all about them again :-). Guess will have to read about 'em again. Thanks! Robert

package.conf in ghc 6.4

2005-04-01 Thread Robert van Herk
Hi all, I am using ghc 6.4 on a Mac, with the binary distribution available from your site. I have a suspision that the package.conf file distributed with it, is incorrect. I am trying to install HSQL. During installation, it issues the command: /usr/local/bin/ghc-pkg -u -g -i hsql.pkg

Re: Allowing duplicate instances in GHC 6.4

2005-03-31 Thread Robert van Herk
Hi Keean, First of all, thank you for your answers. I have tried your solution using TypeEq. instance (Datasource l k' v', TypeEq k k' z, Datasource' z l r k v) = Datasource (JoinedDS l r) k v where _dsread (JoinedDS refl refr) k = do { l - readIORef refl;

Oops [Fwd: Re: Allowing duplicate instances in GHC 6.4]

2005-03-31 Thread Robert van Herk
Sorry, this is the compiler error I get: No instances for (KeyHasValue MyKeyVal k' v', Datasource.Tools.FakePrelude.TypeEq Float k' z, Datasource' z [MyKeyVal] [MyKeyVal] Float Int) When I am trying to do do { createJoinedDS' x x;

[Fwd: Oops [Fwd: Re: Allowing duplicate instances in GHC 6.4]]

2005-03-31 Thread Robert van Herk
Sorry, oops again: The problem is that it complains that it cannot find an instance for Datasource' z [MyKeyVal] [MyKeyVal] Float Int Whilst I have an instance Datasource [MyKeyVal] Float Int Thus, it seems that it needs an explicit type for the z here. Both datasources stored in the joined

Re: Oops [Fwd: Re: Allowing duplicate instances in GHC 6.4]

2005-03-31 Thread Robert van Herk
See change above! Also note type of fundep for Datasource should now be: class Datasource s k v | s - k v where ... I see But the cool thing was, that my datasources were generic, in the sence that they could store multiple k's and v's. Now, they would be unique for the actual storage

Allowing duplicate instances in GHC 6.4

2005-03-25 Thread Robert van Herk
Hi all, I need to use duplicate instances. I read in the documentation on GHC 6.4, that overlapping class instances checks are lazy instead of gready in 6.4. However, my code still gives duplicate instance errors when compiling in GHC 6.4. Is the duplicate instance check still gready? Is there

Re: Allowing duplicate instances in GHC 6.4

2005-03-25 Thread Robert van Herk
Keean Schupke wrote: Robert van Herk wrote: Hi all, I need to use duplicate instances. I read in the documentation on GHC 6.4, that overlapping class instances checks are lazy instead of gready in 6.4. However, my code still gives duplicate instance errors when compiling in GHC 6.4

Re: Allowing duplicate instances in GHC 6.4

2005-03-25 Thread Robert van Herk
key or value types, and whether the loolup is supposed to be value or type driven. My original answer assumed a single Datasource contains values of different types, selected by the type of the key... Keean. Robert van Herk wrote: Yes, but this is not what I want. I want to be able to give