Now suppose that foo3 :: [Int], and I want to prepend 5 to it. I end up having to write something like

let v1 = v0 {foo3 = 5 : (foo3 v0)}

There used to be a feature in pre-Haskell'98 called "named field puns", which allows to use a shorter form of field access. Your example would come out as

  f v0{foo3} =
    let v1 = v0 {foo3 = 5: foo3} in ...

Have a look in the Haskell-1.4 Language Report to see how it works. The behaviour is still supported as an extension by Hugs (-98), nhc98 (-puns), and ghc (-XNamedFieldPuns).

Regards,
    Malcolm

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to