
12 Jul
2007
12 Jul
'07
9:08 a.m.
peterv wrote:
instance Vector Vector2 where dot (V2 x1 y1) (V2 x2 y2) = x1 * x2 + y1 * y2
Amazing, so simple it is, Yoda would say ;)
I did not realize one could perform "partial application" on types when declaring instances (I mean not specifying the type of Vector2 in <instance Vector Vector2>).
Now regarding these funcdeps, are they "ill" as the "rumor" goes?
I don't think there is any danger of them being removed and not replaced. The functionality is useful. Associated Types is widely viewed as a successor/replacement, but no complete implementation exists yet: http://haskell.org/haskellwiki/GHC/Indexed_types I'm sure FDs are here for a while yet. Jules