<div dir="ltr">The term for this is "automatic refactoring". It's a deep problem, but it's been written about a lot.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 24, 2023 at 7:53 AM profited--- via Haskell-Cafe <<a href="mailto:haskell-cafe@haskell.org">haskell-cafe@haskell.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">let's consider this example<br>
Alice has 1.hs like this<br>
v :: (,) Int Bool<br>
v = (,) 0 False<br>
<br>
main :: IO ()<br>
main = putStrLn "print some magic number" >> print ( fst v )<br>
<br>
Bob download 1.hs from Alice<br>
<br>
Bob would like to change 1.hs to 2.hs<br>
Bob want the programs [ 1.hs 2.hs ] to behave the same<br>
<br>
the reason that Bob want to modify 1.hs may be<br>
Bob does not like the type (,) in 1.hs<br>
<br>
Bob has Vector_2.hs<br>
module Vector_2 where<br>
<br>
data Vector_2 a b = C a b<br>
<br>
x1_of :: Vector_2 a b -> a<br>
x1_of ( C x1 _ ) = x1<br>
<br>
x2_of :: Vector_2 a b -> b<br>
x2_of ( C _ x2 ) = x2<br>
<br>
Bob like his Vector_2.hs<br>
Bob thinks the Vector_2 shall be good enough to replace (,) in 1.hs<br>
<br>
i want to create a translator.hs for Bob<br>
Bob tell the translator.hs that Bob want to replace (,) with Vector_2 in 1.hs<br>
translator.hs automatically translate 1.hs to 2.hs<br>
2.hs shall look like this<br>
import Vector_2<br>
( Vector_2 )<br>
import qualified Vector_2<br>
<br>
v :: Vector_2 Int Bool<br>
v = Vector_2.C 0 False<br>
<br>
main :: IO ()<br>
main = putStrLn "print some magic number" >> print ( Vector_2.x1_of v )<br>
<br>
what shall i do ?<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Jeff Brown | Jeffrey Benjamin Brown</div><div dir="ltr"><a href="https://www.linkedin.com/in/jeffreybenjaminbrown" style="font-size:12.8px" target="_blank">LinkedIn</a><span style="font-size:12.8px"> </span><span style="font-size:12.8px">|</span><span style="font-size:12.8px"> </span><a href="https://github.com/jeffreybenjaminbrown" style="font-size:12.8px" target="_blank">Github</a> | <a href="https://twitter.com/carelogic" target="_blank">Twitter</a> | <a href="https://www.facebook.com/mejeff.younotjeff" style="font-size:12.8px" target="_blank">Facebook</a></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>