I'm learning Haskell. 

I was surprised that the following example did not compile:

data Vector2 = Vector2 { x :: Float, y :: Float }
data Vector3 = Vector3 { x :: Float, y :: Float, z :: Float }

error: "Multiple declarations of `Main.x'"

This seems to be a known issue and if I understand it correctly it has to do
with the fact that Haskell does not support function general overloading ala
C++. One either has to use type classes, or put each record in a separate
module and fiddle with the qualified namespaces.

I read multiple papers with proposals to fix this, but does GHC implement
any of these?

Thanks,
Peter





_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to