[Haskell] ambiguous record field names which actually aren’t ambigious

Wolfgang Jeltsch g9ks157k at acme.softbase.org
Mon May 28 11:41:18 EDT 2007


Hello,

I have the following modules:

    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.  However, it should be 
clear that both usages can only refer to B.label since a field name in record 
syntax can only be one that is defined in the same module as the 
corresponding record type.  Hugs accepts the above code.  Is there a way to 
make GHC accept it too?

Best wishes,
Wolfgang


More information about the Haskell mailing list