homplexity

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.Homplexity.CodeFragment

Description

This module generalizes over types of code fragments that may need to be iterated upon and measured separately.

Synopsis

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

occurs :: (CodeFragment c, Data from) => from -> [c]

Direct occurences of given CodeFragment fragment within another structure.

occursOf :: (Data from, CodeFragment c) => Proxy c -> from -> [c]

Explicitly typed variant of occurs.

allOccurs :: (CodeFragment c, Data from) => from -> [c]

All occurences of given type of CodeFragment fragment within another structure.

allOccursOf :: (Data from, CodeFragment c) => Proxy c -> from -> [c]

Explicitly typed variant of allOccurs.

data Program

Program

Constructors

Program 

Fields

allModules :: [Module]
 

programT :: Proxy Program

Proxy for passing Program type as an argument.

program :: [Module] -> Program

Smart constructor for adding cross-references in the future.

moduleT :: Proxy Module

Proxy for passing Module type as an argument.

functionT :: Proxy Function

Proxy for passing Function type as an argument.

data TypeSignature

Type alias for a type signature of a function as a CodeFragment

Constructors

TypeSignature 

Fields

loc :: SrcLoc
 
identifiers :: [Name]
 
theType :: Type
 

typeSignatureT :: Proxy TypeSignature

Proxy for passing Program type as an argument.