hgrep: Search Haskell source code from the command line

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

Search Haskell source code from the command line.

Powered by ghc-exactprint.


[Skip to ReadMe]

Properties

Versions0.0, 0.1, 0.1
Change logCHANGELOG.md
Dependenciesansi-terminal (>=0.6.3 && <0.8), base (>=4.9 && <4.11), bytestring (>=0.10.4 && <0.12), ghc (>=7.10.2 && <8.3), ghc-exactprint (>=0.5.4.0 && <0.6), hgrep, hscolour (==1.24.*), lens (==4.15.*), optparse-applicative (>=0.13 && <0.15), pcre-heavy (==1.0.*), template-haskell (>=2.11 && <2.13) [details]
LicenseBSD-3-Clause
AuthorTim Humphries
Maintainertim@utf8.me
CategoryLanguage
Home pagehttps://github.com/thumphries/hgrep
Bug trackerhttps://github.com/thumphries/hgrep
Source repositoryhead: git clone git://github.com/thumphries/hgrep.git
Executableshgrep
UploadedWed Oct 4 10:39:41 UTC 2017 by TimHumphries

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees


Readme for hgrep-0.1

[back to package description]

hgrep

Search Haskell source code from the command line.

Powered by ghc-exactprint.

Usage

$> hgrep
Usage: hgrep [-e|--regex] EXPRESSION [FILE]

hgrep requires an expression and a set of files to search across.

An expression can be one of

Each file will be parsed and searched. Results will be printed to the console, with syntax highlighting where possible.

Searching for top-level expressions

$> hgrep main main/hgrep.hs
main/hgrep.hs:16:1-13

-- | Run the program.
main :: IO ()
main/hgrep.hs:(17,1)-(18:27)

main = do
  putStrLn "Hello, world!"

Searching for type declarations

$> hgrep PrintOpts src/**/*.hs
src/Language/Haskell/HGrep/Internal/Data.hs:(40,1)-(42,28)

data PrintOpts = PrintOpts {
    poColourOpts :: ColourOpts
  } deriving (Eq, Ord, Show)

Searching with a regular expression

$> hgrep -e 'Opts$' src/**/*.hs
src/Language/Haskell/HGrep/Internal/Data.hs:(57,1)-(59,28)

data PrintOpts = PrintOpts {
    poColourOpts :: ColourOpts
  } deriving (Eq, Ord, Show)
src/Language/Haskell/HGrep/Internal/Data.hs:(61,1)-(64,26)

defaultPrintOpts :: PrintOpts
src/Language/Haskell/HGrep/Internal/Data.hs:(67,1)-(70,5)

defaultPrintOpts =
  PrintOpts {
      poColourOpts = DefaultColours
    }