
Vector (Complex a) is a vector with respect to both 'a' and 'Complex a'.
Even worse, () is a vector w.r.t. *every* scalar type. On Sat, Oct 30, 2010 at 3:07 AM, Henning Thielemann < schlepptop@henning-thielemann.de> wrote:
wren ng thornton schrieb:
On 10/22/10 8:46 AM, Alexey Khudyakov wrote:
Hello everyone!
It's well known that Num & Co type classes are not adequate for vectors (I don't mean arrays). I have an idea how to address this problem.
Conal Elliott wrote very nice set of type classes for vectors. (Definition below). I used them for some time and quite pleased. Code is concise and readable.
class AdditiveGroup v where zeroV :: v (^+^) :: v -> v -> v negateV :: v -> v [...] I'd like to know opinion of haskellers on this and specifically opinion of Conal Eliott as author and maintainer (I CC'ed him)
Looks like you are about to re-implement numeric-prelude. :-)
Just my standard complaint: lack of support for semirings, modules, and other simple/general structures. How come everyone's in such a hurry to run off towards Euclidean spaces et al.?
I'd rather see,
class Additive v where -- or AdditiveMonoid, if preferred zeroV :: v (^+^) :: v -> v -> v
class Additive v => AdditiveGroup v where negateV :: v -> v
type family Scalar :: * -> *
Vector (Complex a) is a vector with respect to both 'a' and 'Complex a'.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe