Giter Club home page Giter Club logo

hsimport's Introduction

hsimport

A command line program for extending the import list of a Haskell source file.

hsimport gets the module name and the symbol name to import as arguments, parses the given source file by using the library haskell-src-exts and than tries to only extend the import list if it's necessary. If the symbol is already imported or if the whole module is already imported, than the given source file isn't changed.

Installation

cabal install hsimport

Examples

$ hsimport -m 'Control.Monad' SomeSource.hs`
=> import Control.Monad

$ hsimport -m 'Control.Monad' -s 'when' SomeSource.hs
=> import Control.Monad (when)

$ hsimport -m 'Control.Monad' -q 'CM' SomeSource.hs
=> import qualified Control.Monad as CM

Text Editor Integration

vim-hsimport

Command Line Usage

dan@machine ~> hsimport --help
hsimport [OPTIONS] [SOURCEFILE]
  A command line program for extending the import list of a Haskell source
  file.

Common flags:
  -m --modulename=ITEM     The module to import
  -s --symbolname=ITEM     The symbol to import, if empty, the entire module
                           is imported
  -q --qualifiedname=ITEM  The name to use for a qualified module import
  -o --outputsrcfile=FILE  Save modified source file to file, if empty, the
                           source file is modified inplace
  -h --help                Display help message
  -v --version             Print version information

Issues

There is some rudimentarily handling for code using CPP, but the import statements might be added at the wrong place, because the lines containing CPP directives are ignored and therefore they aren't considered in the source line count.

hsimport's People

Contributors

dan-t avatar ocharles avatar

Watchers

 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.