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 v'',D
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 o
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
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 mech
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 datas
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 M
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::Mayb
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;
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 ..
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
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
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
http://www.haskell.org/mail
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 dupl
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 dupl
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
15 matches
Mail list logo