Why doesn't Haskell/GHC support record name overloading
haskell, naming, record
Solution
Historical reasons. There have been many competing designs for better record systems for Haskell -- so many in fact, that no consensus could be reached. Yet.
Problem
I am a Haskell newbie. I have noticed that Haskell does not support record name overloading: ``` -- Records.hs data Employee = Employee { firstName :: String , lastName :: String , ssn :: String } deriving (Show, Eq) data Manager = Manager { firstName :: String , lastName :: String , ssn :: String , subordinates :: [Employee] } deriving (Show, Eq) ``` When I compile this I get: ``` [1 of 1] Compiling Main ( Records.hs, Records.o ) Records.hs:10:5: Multiple declarations of `firstName' Declared at: Records.hs:4:5 Records.hs:10:5 Records.hs:11:5: Multiple declarations of `lastName' Declared at: Records.hs:5:5 Records.hs:11:5 Records.hs:12:5: Multiple declarations of `ssn' Declared at: Records.hs:6:5 Records.hs:12:5 ``` Given the "strength" of the Haskell type system, it seems like it should be easy for the compiler to determine which field to access in ``` emp = Employee "Joe" "Smith" "111-22-3333" man = Manager "Mary" "Jones" "333-22-1111" [emp] firstName man firstName emp ``` Is there some issue that I am not seeing. I know that the Haskell Report does not allow this, but why not?