Phlex schrieb:
> I have this class which gives a common interface to (UniqueIndex a k)
> and (MultiIndex a k) :

I do not understand this

> class (Show a, Key_ k) => Index_ i a k  | i -> k, k -> a where
>   buildKey :: (a -> k)

this method "buildKey" is not sufficient to derive the type "i" in an
application ("i" determines "k" but not vice versa)

[...]
> Now i need to have these indexes in a list, so i declared that type :
> 
> data DbIndex = forall a k i. (Show a, Key_ k, Index_ i a k) => DbIndex i

  data DbIndex = forall a k i. (Index_ i a k) => DbIndex i

should do as well.

> for instance, this doesn't work:
> liftDbIndex (DbIndex index) fun = DbIndex (fun index)

you can apply only a method of Index_ to index.

> this doesn't work either :
> dbIndexBuildKey (DbIndex index) value = (buildKey index) value

buildKey's type is not sufficient (see above)

> How can i access the enclosed concrete index, via its Index_ class ?

Add corresponding methods to the class. (Alternatively or additionally
store an index as a dynamic value.)

HTH Christian
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to