Copyright | (c) 2020 Kowainik |
---|---|
License | MPL-2.0 |
Maintainer | Kowainik <xrom.xkov@gmail.com> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Functions to work with hie
specific parts.
Synopsis
- readHieFiles :: FilePath -> IO [HieFile]
- countLinesOfCode :: HieFile -> Int
- eqAst :: forall a. Ord a => HieFile -> HieAST a -> HieAST a -> Bool
- slice :: RealSrcSpan -> ByteString -> Maybe ByteString
Documentation
readHieFiles :: FilePath -> IO [HieFile] Source #
Returns contents of all .hie
files recursively in the given
hie
directory.
countLinesOfCode :: HieFile -> Int Source #
Get the number of lines of code in the file by analising HieFile
.
eqAst :: forall a. Ord a => HieFile -> HieAST a -> HieAST a -> Bool Source #
Compare two AST nodes on equality. This is a more relaxed version
of the Eq
instance for HieAST
because it doesn't compare source
locations. This function is useful if you want to check whether two
AST nodes represent the same AST.
This function needs to take the original HieFile
because constants
are not stored in HieAST
and to compare constants we need to compare
parts of source code.
slice :: RealSrcSpan -> ByteString -> Maybe ByteString Source #
Take sub-bytestring according to a given span.
When the given source is empty returns Nothing
.
TODO: currently works only with single-line spans