| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Language.Haskell.Homplexity.CodeFragment
Description
This module generalizes over types of code fragments that may need to be iterated upon and measured separately.
- class (Show c, Data (AST c), Data c) => CodeFragment c where
- fragmentName :: c -> String
- occurs :: (CodeFragment c, Data from) => from -> [c]
- allOccurs :: (CodeFragment c, Data from) => from -> [c]
- data Program = Program {
- allModules :: [Module]
- programT :: Proxy Program
- data Module :: * = Module SrcLoc ModuleName [ModulePragma] (Maybe WarningText) (Maybe [ExportSpec]) [ImportDecl] [Decl]
- moduleT :: Proxy Module
- data Function = Function {
- functionNames :: [String]
- functionLocations :: [SrcLoc]
- functionRhs :: [Rhs]
- functionBinds :: [Binds]
- functionT :: Proxy Function
- data TypeSignature = TypeSignature {}
- typeSignatureT :: Proxy TypeSignature
- fragmentLoc :: CodeFragment c => c -> SrcLoc
Documentation
class (Show c, Data (AST c), Data c) => CodeFragment c where
Class CodeFragment allows for:
* both selecting direct or all descendants
of the given type of object within another structure
(with occurs and allOccurs)
* naming the object to allow user to distinguish it.
In order to compute selection, we just need to know which
AST nodes contain the given object, and how to extract
this given object from AST, if it is there (matchAST).:w
Minimal complete definition
matchAST, fragmentName
Methods
fragmentName :: c -> String
occurs :: (CodeFragment c, Data from) => from -> [c]
Direct occurences of given CodeFragment fragment within another structure.
allOccurs :: (CodeFragment c, Data from) => from -> [c]
All occurences of given type of CodeFragment fragment within another structure.
data Module :: *
A complete Haskell source module.
Constructors
| Module SrcLoc ModuleName [ModulePragma] (Maybe WarningText) (Maybe [ExportSpec]) [ImportDecl] [Decl] |
Instances
| Eq Module | |
| Data Module | |
| Ord Module | |
| Show Module | |
| Generic Module | |
| Parseable Module | |
| AppFixity Module | |
| CodeFragment Module | |
| type Rep Module = D1 D1Module (C1 C1_0Module ((:*:) ((:*:) (S1 NoSelector (Rec0 SrcLoc)) ((:*:) (S1 NoSelector (Rec0 ModuleName)) (S1 NoSelector (Rec0 [ModulePragma])))) ((:*:) ((:*:) (S1 NoSelector (Rec0 (Maybe WarningText))) (S1 NoSelector (Rec0 (Maybe [ExportSpec])))) ((:*:) (S1 NoSelector (Rec0 [ImportDecl])) (S1 NoSelector (Rec0 [Decl])))))) |
data Function
Alias for a function declaration
Constructors
| Function | |
Fields
| |
data TypeSignature
Constructors
| TypeSignature | |
typeSignatureT :: Proxy TypeSignature
Proxy for passing Program type as an argument.
fragmentLoc :: CodeFragment c => c -> SrcLoc