[Haskell] ambiguous record field names which actually aren’t ambigious
Wolfgang Jeltsch
g9ks157k at acme.softbase.org
Tue May 29 12:22:24 EDT 2007
Am Dienstag, 29. Mai 2007 17:19 schrieben Sie:
> [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!
Oops, I forgot to include the import line.
> And if you mean that B does import A, then Haskell 98 indeed says it's
> ambiguous.
But wouldn’t it be worthwhile to allow this kind of stuff as a language
extension? It would make life easier in a couple of situations. I don’t
like the idea of using advanced record implemenations based on contended
language extensions (undecidable instances, etc.), thereby probably loosing
pattern matching, just to get rid of the need to qualify field names. :-(
> […]
Best wishes,
Wolfgang
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs at haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
More information about the Glasgow-haskell-bugs
mailing list