<br><br><div class="gmail_quote">On Tue, Jul 28, 2009 at 7:47 AM, Henry Laxen <span dir="ltr">&lt;<a href="mailto:nadine.and.henry@pobox.com">nadine.and.henry@pobox.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">Malcolm Wallace &lt;Malcolm.Wallace &lt;at&gt; <a href="http://cs.york.ac.uk" target="_blank">cs.york.ac.uk</a>&gt; writes:<br>
<br>
&gt;<br>
&gt; &gt; and perhaps use emacs to<br>
&gt; &gt; query-replace all the Foo1&#39;s back to Foo&#39;s<br>
&gt;<br>
&gt; At least this bit can be avoided easily enough, by using<br>
&gt; module qualification during the conversion process.<br>
&gt;<br>
&gt;      module Original (Foo(..)) where<br>
&gt;      data Foo = Foo { ... y :: Int } deriving ...<br>
&gt;<br>
&gt;      module New (Foo(..)) where<br>
&gt;      data Foo = Foo { ... y, z :: Int } deriving ...<br>
&gt;<br>
&gt;      module Convert where<br>
&gt;      import Original as Old<br>
&gt;      import New as New<br>
&gt;      newFoo :: Old.Foo -&gt; New.Foo<br>
&gt;      newFoo old{..} = New.Foo { a=a, b=b, ... z=1 }<br>
&gt;<br>
&gt; Finally rename module New.<br>
&gt;<br>
&gt; Regards,<br>
&gt;      Malcolm<br>
&gt;<br>
<br>
</div>Thanks Malcolm, yes, that keeps me out of emacs, but the part I would really<br>
like to avoid is writing the New.Foo { a=a, b=b, ... z=1 } part, where the field<br>
names are many, long, and varied.  Yes, I could cut and paste, but I&#39;m hoping<br>
for a &quot;better way.&quot;  Thanks.</blockquote><div><br>I guess you could define:<br>type UpgradeFoo = (Foo, Int)<br><br>And then write the conversion code as a zip.  upgradeFoo foos = zip foos [1..]<br><br>instance Show UpgradeFoo where ...<br>
<br>And then use the module trick to switch the code around?<br><br>Jason</div></div>