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;
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;
;
(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
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
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
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
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
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
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
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
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
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
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
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
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
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
16 matches
Mail list logo