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;
Robert van Herk wrote:
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;
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