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;

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

2005-03-31 Thread Keean Schupke
; (joined,(v::Maybe Int)) - _dsread joined (2.0::Float); } Robert Subject: Re: Allowing duplicate instances in GHC 6.4 From: Robert van Herk [EMAIL PROTECTED] Date: Thu, 31 Mar 2005 16:49:07 +0200 To: glasgow

[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

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

2005-03-31 Thread Keean Schupke
Some more fixes... Keean Schupke wrote: 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

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

2005-03-31 Thread Keean Schupke
Not at all... You can have Datasource s k v | s k - v ... but I have't time to do it now... By the way that wasn't the change I was talking about! class Datasource' z l r k v | z l r k - v The 'z' was missing from your fundep. Keean. Robert van Herk wrote: See change above! Also note type of

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

2005-03-31 Thread Keean Schupke
In the case where a datasource is determined by 's' and 'k', we need to return a different type depending on sucess or failure: data TJust t = TJust t data TNothing = TNothing class Datasource s k v | s k - v where dsread :: s - k - v instance (Datasource l k v',Datasource r k

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 Keean Schupke
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. Is the duplicate instance check

Re: Allowing duplicate instances in GHC 6.4

2005-03-25 Thread Keean Schupke
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. Is the

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. Is the

Re: Allowing duplicate instances in GHC 6.4

2005-03-25 Thread Keean Schupke
There was a typo in the code I posted: class Fail data This_should_never_happen should read: class Fail x data This_should_never_happen Keean. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org

Re: Allowing duplicate instances in GHC 6.4

2005-03-25 Thread Keean Schupke
Just thought I ought to point out that all this is only necessary if the datasources may return different types... If you want them to return the same type you only need: instance (Datasource l k v,Datasource r k v) = Datasource (JoinedDS l r) k v ... As both datasources have the same key and

Re: Allowing duplicate instances in GHC 6.4

2005-03-25 Thread Robert van Herk
Keean Schupke wrote: Just thought I ought to point out that all this is only necessary if the datasources may return different types... If you want them to return the same type you only need: instance (Datasource l k v,Datasource r k v) = Datasource (JoinedDS l r) k v ... As both datasources

Re: Allowing duplicate instances in GHC 6.4

2005-03-25 Thread Keean Schupke
Robert van Herk wrote: Keean Schupke wrote: Just thought I ought to point out that all this is only necessary if the datasources may return different types... If you want them to return the same type you only need: instance (Datasource l k v,Datasource r k v) = Datasource (JoinedDS l r) k v