[Haskell-cafe] Haskell's overlooked object system: was OO idioms redux

MR K P SCHUPKE k.schupke at imperial.ac.uk
Fri Oct 15 05:48:53 EDT 2004

>Although I still miss a simple primitive language construct to do
>'extensible record',

If you look at the OOHaskell, and HList papers, you will see
the neatest way of defining an HList based extensible record

        record = label1 .=. value1
                .*. label2 .=. value2
                .*. label3 .=. value3
                .*. emptyRecord

A record is built by using the record-product operator (.*.)
on a label-value pair and a record... emptyRecord is obviously
provided so you can start with 'nothing'. All the class definitions
to make this possible are hidden in the HList library... The only
other thing required is to declare your labels...


More information about the Haskell-Cafe mailing list