-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Simon Peyton-Jones wrote:
> [Redirecting to ghc-bugs]
>
> | module A where
> | data A = A { label :: Int }
> |
> | module B where
> | data B = B { label :: Int }
> |
> | b :: B
> | b = B { label = 0 }
> |
> | x :: B -> ()
> | x B { label = 0 } = ()
> |
> | GHC reports an ambiguity for both usages of label.
>
> Are you sure? Module B doesn't even import A!
>
> And if you mean that B does import A, then Haskell 98 indeed says it's
> ambiguous.
>
> Now, it's true that in the case of both
> a) pattern matching
> b) record construction
> there's a lot less ambiguity, because you know which *data constructor* is
> involved. (Even better than knowing which module is involved. But for
> c) record update (x { label = 0 })
> d) field selection (label x)
> you have no such clues.
You may be able to infer which type it is (that should be enough) by
type inference, for c and maybe d - but that sounds fragile assuming
that record update and field selection currently _provide_ the
typechecker with information.
Isaac
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGXFo0HgcxvIWYTTURAj3aAJ4pRaEsXGwWObUs9rYDSsm1caN8JwCgmKPp
JqhY1YWCS+yPB9lhwan175U=
=8fwY
-----END PGP SIGNATURE-----
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs