Coder Social home page Coder Social logo

hsmv's Introduction

hsmv

Program to rename Haskell modules.

Haskell module rename

Usage: hsmv [--version] [--help] --from ARG --to ARG --from-path ARG
            --to-path ARG MODULEPATH [--dry-run] [--no-auto-qualify]
  This program renames modules.

Available options:
  --version                Show version
  --help                   Show this help text
  --from ARG               The original module name
  --to ARG                 The target module name
  --from-path ARG          The original module path
  --to-path ARG            The target module path
  MODULEPATH               Filepath for a module
  --dry-run                Don't make changes, just print what would be done.
  --no-auto-qualify        Disable auto-qualify

Pipe in all the files in your project. If I were to do it on this project, it would be:

$ find src app test -name '*.hs' | \
  xargs hsmv --from Hsmv --to Hsmv2 \
             --from-path src/Hsmv.hs --to-path src/Hsmv2.hs

You can use --dry-run to see what would be changed in all the files before running it.

By default, modules are aliased with the name of their old name. This means the module will still compile despite the rename. If they're already qualified, the qualification is untouched. Disable this feature via --no-auto-qualify.

Scope and limitations

  • Renames headers module X ...
  • Renames imports import .. X
  • Does not rename qualified expressions X.sort, for example. May in the future.

Note:

Use one of these to implement anchored replace:

findFirstPrefix :: RE' a -> Text -> Maybe (a, Text)
findLongestPrefix :: RE' a -> Text -> Maybe (a, Text)
findShortestPrefix :: RE' a -> Text -> Maybe (a, Text)

Currently the match is an infix match, which is a bug.

hsmv's People

Contributors

anton-latukha avatar chrisdone avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.