I would suggest defining types for unit and functions...
data Scalar a = Scalar a
data Function c v = Function c v
instance VSpace a (Scalar a) ... -- replaces 'a'
instance VSpace a (Function c a) ... -- replaces c -> a
instance VSpace a v => a (Function c v) ... -- replaces c -> v
Here Scalar is j
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
wrote:
> This is what I want. For a given set of vectors, the associated
> scalars are unique, otherwise I would have problems with norm.
> But I have problems anyway...
> >> instance Vspace a a where
This says, for any vector type "a", the ass
[EMAIL PROTECTED] writes:
> This is what I want. For a given set of vectors, the associated
> scalars are unique, otherwise I would have problems with norm.
In the instance Vspace a a the compiler doesn't know that "a" is
supposed to be a scalar only. It matches vector types (functions) too.
And
Ashley Yakeley writes:
GHCi is correct to complain:
class Vspace a v | v -> a
OK, the first parameter ("a") depends on the second ("v").
This is what I want. For a given set of vectors, the associated
scalars are unique, otherwise I would have problems with norm.
But I have problems anyway...
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
wrote:
GHCi is correct to complain:
> class Vspace a v | v -> a
OK, the first parameter ("a") depends on the second ("v").
> instance Vspace a a where
And this determines it: the first parameter must always be the same as
the second.
> insta