Keep the present Haskell record system!

Bulat Ziganshin bulat.ziganshin at
Sun Mar 19 10:12:52 EST 2006

Hello Claus,

Monday, March 6, 2006, 2:35:04 PM, you wrote:

>> also, while i like dynamic records for some types of tasks, i think
>> that the "spirit" of Haskell in whole is to give explicit definitions
>> of all types used and in this respect this type extension in not on
>> "main way". 

CR> record extension is the basis for record concatenation, which is
CR> the basis for composing programs that use records. for instance,
CR> if you have two attribute grammars that compute two sets of
CR> attributes and you want to compose them into a single grammar,
CR> you run into troubles. (dual arguments for extensible variants,
CR> be it for exception types, or for extensible grammars that cover
CR> haskell+extensions without having to specify and maintain two 
CR> separate grammars). and the concept of partial type specifications
CR> is not uncommon in Haskell (polymorphism, type classes).

(sorry for late answer)

this again should be maintained in "Haskell way", i.e. with static
type declarations:

data Pizza = ...
data Cola = ...

type PizzaWithCola = Pizza+Cola

weight :: PizzaWithCola -> Double
weight pc = pizzaWeight pc + colaWeight pc

pizzaWeight :: Pizza -> Double
colaWeight  :: Cola  -> Double

it is one more remainder of what we need OOP-like features such as
data fields inheritance. O'Haskell has something in this area,
although afair it doesn't support the multiple inheritance

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at

More information about the Haskell-prime mailing list