Skip to content
Command-line tool to rename modules in Haskell projects
Branch: master
Clone or download
Latest commit 9917f49 Sep 27, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.cargo linker etc. Nov 27, 2017
benches formatting etc. Jul 17, 2018
ci try?? idk. Nov 27, 2017
data lexer May 7, 2018
src minor Sep 27, 2018
.gitignore nicer haskell parser for some things Nov 4, 2017
.travis.yml netbsd May 7, 2018
Cargo.toml diffs Jul 1, 2018
Justfile clippy etc. Sep 25, 2018
LICENSE initial-ish commit Jul 28, 2017
README.md updates to haskell parser (fixes for strings in particular) Dec 8, 2017
TODO.md updates to haskell parser (fixes for strings in particular) Dec 8, 2017
appveyor.yml appveyor Nov 22, 2017

README.md

hask-replace

Windows build status Build Status

hask-replace is a command-line tool for renaming Haskell, Elm, PureScript, and Idris modules.

The Pitch

Here's an example of how you would use hr:

cabal unpack dhall
cd dhall-1.5.1/
hr module . "Dhall.Import" "Dhall.Dependencies"
cabal new-build

As you can see, it's a lot less painful than whatever witchcraft you'd have to resort to to accomplish the same thing in bash.

The Anti-Pitch

hr doesn't attempt to be a full parser for cabal, idris, elm, etc. While hr promises to always transform valid projects into valid projects, it won't necessarily point out errors in your project.

Installation

Script

The easiest way to install for most users is probably via a shell script, viz.

curl -LSfs https://japaric.github.io/trust/install.sh | sh -s -- --git vmchale/hask-replace

Binary releases

If the script doesn't work, you can also download prebuilt binaries. You can find binaries for various platforms on the release page.

Cargo

First, install cargo. Then:

 $ cargo install --git https://github.com/vmchale/hask-replace

You will need to use the nightly release for this to work; if in doubt run

 $ rustup run nightly cargo install --git https://github.com/vmchale/hask-replace

Performance

Package Task Time
dhall Rename Module 7.185 ms
lens Rename Module 9.671 ms

Use

Example use:

git clone https://github.com/HuwCampbell/idris-lens.git
cd idris-lens
hr idris . Control.Lens.Maths Control.Lens.Math
idris --build lens.ipkg

Vim Plugin

There is a vim plugin for hask-replace here. It supports copying and moving Haskell, Elm, and Idris modules.

You can’t perform that action at this time.