Isaac Dupree <[EMAIL PROTECTED]> wrote: > > Adde wrote: > > tmp <- foo > > return Bar { > > barFoo = tmp > > } > > There is a feature being worked on in GHC HEAD that would let you do > > do > tmp <- foo > return Bar{..} > > which captures fields from everything of the same name that's in scope. > I think this would also satisfy your desire. >
I guess this means I could write: data D = C {field1 :: Bool, field2 :: Char} f x = do field1 <- foo1 field2 <- foo2 field3 <- foo3 other stuff return C{..} instead of f x = do tmp1 <- foo1 tmp2 <- foo2 field3 <- foo3 other stuff return $ C { field1 = tmp1, field2 = tmp2 } This has a dangerous feel to it --- extending the definition of D to include a field field3 may have quite unintended consequences. What I am missing most in the record arena is a functional notation for record update, for example: {^ field1 } = \ f r -> r {field1 = f (field1 r)} _______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime