A lightweight vim plugin that helps you refactor Haskell code.
With Plug
add,
Plug 'chris-bacon/haskell-refactor'
to your vimrc.
Alternatively, you can clone this repo.
Select the code you wish to refactor in visual mode. You can then use the following commands:
:ExtractHaskellFunction <name> <params>
:ExtractHaskellType <name>
All options are optional. Every command will default to a prompt if no args are provided, so you do not need to provide any arguments. This also means you can use the following mappings.
You following are examples of mappings you could create for each command:
vnoremap <leader>ef :ExtractHaskellFunction<cr>
vnoremap <leader>et :ExtractHaskellType<cr>
Please feel free to raise any issues or PRs.
There are some tests to ensure regressions are not added.
You will need to have vader installed. Then you will be able to run :Vader .vader
and hopefully see the following output:
Unfortunately, the tests are sensitive to whitespace so you will have to be vigilent with regards to whitespace.