[Haskell-cafe] Adding a field to a data record

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Tue Jul 28 10:40:16 EDT 2009

> and perhaps use emacs to
> query-replace all the Foo1's back to Foo's

At least this bit can be avoided easily enough, by using
module qualification during the conversion process.

     module Original (Foo(..)) where
     data Foo = Foo { ... y :: Int } deriving ...

     module New (Foo(..)) where
     data Foo = Foo { ... y, z :: Int } deriving ...

     module Convert where
     import Original as Old
     import New as New
     newFoo :: Old.Foo -> New.Foo
     newFoo old{..} = New.Foo { a=a, b=b, ... z=1 }

Finally rename module New.


More information about the Haskell-Cafe mailing list