Whoops, I messed up that first example: module PreludePre_7_6 (module Prelude, catch) where
import Prelude import qualified System.IO.Error as E catch = E.catch On Thu, Aug 30, 2012 at 12:16 PM, Michael Sloan <mgsl...@gmail.com> wrote: > A good way to specify such refactorings is as a Haskell module. For example: > > > module PreludePre_7_6 where > > import Prelude hiding ( catch ) > > > Or, an example of avoiding the Eq / Show / Num debacle: > > module PreludePre_7_4 (module Prelude, Num) where > > import Prelude hiding ( Num ) > import qualified Prelude as P > > instance template (Eq a, Show a) => Num a where > instance P.Num a > > > (Uses my instance template proposal - though with different keywords - > https://github.com/mgsloan/instance-templates ) > > > Let's say we wanted to rename "catch" to "unsafeCatch" > > module PreludePreUnsafeCatch (module Prelude, catch) where > > import Prelude hiding (unsafeCatch) > > catch = unsafeCatch > > > Then, an automated refactoring system is "simply" a sourcecode-based > module inliner. Quite a bit of effort, certainly, but it's much > better than coming up with a whole new notation for refactorings. > > -Michael > > On Thu, Aug 30, 2012 at 6:34 AM, Alexander Bernauer > <alex-hask...@copton.net> wrote: >> Hi >> >> I agree that automatic code migration can solve this issue in large >> parts. The Python folks have done this to mitigate the transition from >> version 2 to version 3 [1]. >> >> On Thu, Aug 30, 2012 at 03:03:05PM +0200, Alexander Kjeldaas wrote: >>> perl -ni -e 'print unless /import Prelude hiding \(catch\)/' $(git grep >>> 'import Prelude hiding (catch)') >> >> I don't think regular expressions are powerful enough. This example >> does not match on hiding multiple names, for instance. >> >> But writing proper 'HsModule -> HsModule' functions should be doable. >> >> And when each release comes with a bunch of such functions, packages >> could be automatically migrated. >> >> Greetings >> >> Alex >> >> [1] http://docs.python.org/library/2to3.html >> >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v1.4.10 (GNU/Linux) >> >> iEYEARECAAYFAlA/a/oACgkQevm6Dd/q44nJXQCffaxEJ/NZEftgoZ7viAWMuBO3 >> +jkAnRTw+VCMQn1k9NibyKpkGMtwvrQw >> =ds3M >> -----END PGP SIGNATURE----- >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe@haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe