data label overloading

Hal Daume III hdaume at ISI.EDU
Tue Jan 13 06:58:39 EST 2004


>   data Foo1 = Foo1 {size :: Int ...}
>   ...
>   data Foo2 = Foo2 {size :: Int ...}
>   ...
>   f x y z = let size = Foo1..size 
>             in
>             (size x) + (size y) + (Foo2..size z)  

How does this save you typing over:

data Foo1 = Foo1 { foo1_size :: Int }
data Foo2 = Foo2 { foo2_size :: Int }

f x y z = let size = foo1_size
          in
          (size x) + (size y) + (Foo2..size z)

also, this would lead to highly ambiguous parses, i think.

 - hal

-- 
 Hal Daume III                                   | hdaume at isi.edu
 "Arrest this man, he talks in maths."           | www.isi.edu/~hdaume




More information about the Haskell mailing list