Portability | portable |
---|---|
Stability | beta |
Maintainer | jpmoresmau@gmail.com |
Safe Haskell | None |
Data types, State Monad, utility functions
- type BuildWrapper = StateT BuildWrapperState IO
- data BuildWrapperState = BuildWrapperState {
- tempFolder :: String
- cabalPath :: FilePath
- cabalFile :: FilePath
- verbosity :: Verbosity
- cabalFlags :: String
- cabalOpts :: [String]
- logCabalArgs :: Bool
- data BWNoteStatus
- readObj :: Read a => String -> String -> a
- data BWLocation = BWLocation {}
- mkEmptySpan :: FilePath -> Int -> Int -> BWLocation
- data BWNote = BWNote {}
- isBWNoteError :: BWNote -> Bool
- type OpResult a = (a, [BWNote])
- data BuildResult = BuildResult Bool [FilePath]
- data WhichCabal
- data OutlineDefType
- data InFileLoc = InFileLoc {}
- data InFileSpan = InFileSpan {}
- ifsOverlap :: InFileSpan -> InFileSpan -> Bool
- iflOverlap :: InFileSpan -> InFileLoc -> Bool
- mkFileSpan :: Int -> Int -> Int -> Int -> InFileSpan
- data NameDef = NameDef {
- ndName :: Text
- ndType :: [OutlineDefType]
- ndSignature :: Maybe Text
- data OutlineDef = OutlineDef {
- odName :: Text
- odType :: [OutlineDefType]
- odLoc :: InFileSpan
- odChildren :: [OutlineDef]
- odSignature :: Maybe Text
- odComment :: Maybe Text
- mkOutlineDef :: Text -> [OutlineDefType] -> InFileSpan -> OutlineDef
- mkOutlineDefWithChildren :: Text -> [OutlineDefType] -> InFileSpan -> [OutlineDef] -> OutlineDef
- data TokenDef = TokenDef {
- tdName :: Text
- tdLoc :: InFileSpan
- data ImportExportType
- = IEVar
- | IEAbs
- | IEThingAll
- | IEThingWith
- | IEModule
- data ExportDef = ExportDef {
- eName :: Text
- eType :: ImportExportType
- eLoc :: InFileSpan
- eChildren :: [Text]
- data ImportSpecDef = ImportSpecDef {
- isName :: Text
- isType :: ImportExportType
- isLoc :: InFileSpan
- isChildren :: [Text]
- data ImportDef = ImportDef {}
- data OutlineResult = OutlineResult {}
- data BuildFlags = BuildFlags {}
- data ThingAtPoint = ThingAtPoint {}
- getFullTempDir :: BuildWrapper FilePath
- getDistDir :: BuildWrapper FilePath
- getTargetPath :: FilePath -> BuildWrapper FilePath
- canonicalizeFullPath :: FilePath -> BuildWrapper FilePath
- getFullSrc :: FilePath -> BuildWrapper FilePath
- copyFromMain :: Bool -> FilePath -> BuildWrapper (Maybe FilePath)
- isSourceMoreRecent :: FilePath -> FilePath -> IO Bool
- fileToModule :: FilePath -> String
- data Verbosity
- data CabalComponent
- = CCLibrary {
- ccBuildable :: Bool
- | CCExecutable {
- ccExeName :: String
- ccBuildable :: Bool
- | CCTestSuite {
- ccTestName :: String
- ccBuildable :: Bool
- = CCLibrary {
- cabalComponentName :: CabalComponent -> String
- data CabalPackage = CabalPackage {
- cpName :: String
- cpVersion :: String
- cpExposed :: Bool
- cpDependent :: [CabalComponent]
- cpModules :: [String]
- data ImportClean = ImportClean {
- icSpan :: InFileSpan
- icText :: Text
- data LoadContents
- = SingleFile { }
- | MultipleFile { }
- getLoadFiles :: LoadContents -> [(FilePath, String)]
- getRecursiveContents :: FilePath -> IO [FilePath]
- getRecursiveContentsHidden :: FilePath -> IO [FilePath]
- deleteGhosts :: [FilePath] -> BuildWrapper [FilePath]
- deleteTemp :: BuildWrapper ()
- deleteGenerated :: BuildWrapper ()
- fromJustDebug :: String -> Maybe a -> a
- removeBaseDir :: FilePath -> String -> String
- nubOrd :: Ord a => [a] -> [a]
- formatJSON :: String -> String
- data Usage = Usage {}
- readFile :: FilePath -> IO String
- writeFile :: FilePath -> String -> IO ()
- withBinaryFile :: FilePath -> IOMode -> (Handle -> IO a) -> IO a
Documentation
type BuildWrapper = StateT BuildWrapperState IOSource
State type
data BuildWrapperState Source
the state we keep
BuildWrapperState | |
|
data BWNoteStatus Source
status of notes: error or warning
readObj :: Read a => String -> String -> aSource
read an object from a String, with a given error message if it fails
mkEmptySpan :: FilePath -> Int -> Int -> BWLocationSource
build an empty span in a given file at a given location
a note on a source file
BWNote | |
|
isBWNoteError :: BWNote -> BoolSource
is a note an error?
type OpResult a = (a, [BWNote])Source
simple type encapsulating the fact the operations return along with notes generated on files
data BuildResult Source
result: success + files impacted
data WhichCabal Source
result for building one file: success + names data Build1Result=Build1Result Bool [NameDef] deriving (Show,Read,Eq)
instance ToJSON Build1Result where toJSON (Build1Result b ns)= object [r .= b, ns .= map toJSON ns]
instance FromJSON Build1Result where parseJSON (Object v) =Build1Result $ v .: r * v .: ns parseJSON _= mzero
which cabal file to use operations
data OutlineDefType Source
type of elements for the outline
Location inside a file, the file is known and doesn't need to be repeated
data InFileSpan Source
Span inside a file, the file is known and doesn't need to be repeated
ifsOverlap :: InFileSpan -> InFileSpan -> BoolSource
do spans overlap?
iflOverlap :: InFileSpan -> InFileLoc -> BoolSource
does span overlap location?
:: Int | start line |
-> Int | start column |
-> Int | end line |
-> Int | end column |
-> InFileSpan |
construct a file span
definition of a name
NameDef | |
|
data OutlineDef Source
element of the outline result
OutlineDef | |
|
:: Text | name |
-> [OutlineDefType] | types: can have several to combine |
-> InFileSpan | span in source |
-> OutlineDef |
constructs an OutlineDef with no children and no type signature
mkOutlineDefWithChildrenSource
:: Text | name |
-> [OutlineDefType] | types: can have several to combine |
-> InFileSpan | span in source |
-> [OutlineDef] | children (constructors...) |
-> OutlineDef |
constructs an OutlineDef with children and no type signature
Lexer token
TokenDef | |
|
data ImportExportType Source
Type of import/export directive
IEVar | Var |
IEAbs | Abs |
IEThingAll | import/export everything |
IEThingWith | specific import/export list |
IEModule | reexport module |
definition of export
ExportDef | |
|
data ImportSpecDef Source
definition of an import element
ImportSpecDef | |
|
definition of an import statement
getFullTempDir :: BuildWrapper FilePathSource
get the full path for the temporary directory
getDistDir :: BuildWrapper FilePathSource
get the full path for the temporary dist directory (where cabal will write its output)
:: FilePath | relative path of source file |
-> BuildWrapper FilePath |
get full path in temporary folder for source file (i.e. where we're going to write the temporary contents of an edited file)
:: FilePath | relative path of source file |
-> BuildWrapper FilePath |
get the full, canonicalized path of a source
:: FilePath | relative path of source file |
-> BuildWrapper FilePath |
get the full path of a source
:: Bool | copy even if temp file is newer |
-> FilePath | relative path of source file |
-> BuildWrapper (Maybe FilePath) | return Just the file if copied, Nothing if no copy was done |
copy a file from the normal folders to the temp folder
isSourceMoreRecent :: FilePath -> FilePath -> IO BoolSource
is the source file more recent than the target file?
fileToModule :: FilePath -> StringSource
replace relative file path by module name
Verbosity settings
data CabalComponent Source
component in cabal file
CCLibrary | library |
| |
CCExecutable | executable |
| |
CCTestSuite | test suite |
|
cabalComponentName :: CabalComponent -> StringSource
get the cabal component name
data CabalPackage Source
a cabal package
CabalPackage | |
|
data ImportClean Source
import clean operation: the span of text to change, the new text
ImportClean | |
|
data LoadContents Source
information about files to load (single file or multiple files)
getLoadFiles :: LoadContents -> [(FilePath, String)]Source
get files to load
getRecursiveContents :: FilePath -> IO [FilePath]Source
deleteGhosts :: [FilePath] -> BuildWrapper [FilePath]Source
delete files in temp folder but not in real folder anymore
deleteTemp :: BuildWrapper ()Source
delete all temporary files
deleteGenerated :: BuildWrapper ()Source
delete generated files
fromJustDebug :: String -> Maybe a -> aSource
debug method: fromJust with a message to display when we get Nothing
removeBaseDir :: FilePath -> String -> StringSource
remove a base directory from a string representing a full path
formatJSON :: String -> StringSource
debug method to vaguely format JSON result to dump them
Usage structure