-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | simple and interactive command-line build tool
--
-- Shaker is a build tool which allow to simply compile or launch test on
-- an haskell project and provides some interesting features like
-- continuous action. With continuous action, an action (compile or test)
-- will be automatically executed when a source modification is detected.
--
-- All configuration are made via cabal; Shaker will read cabal
-- configuration to discover source directories, compilation options and
-- targets to compile.
--
-- Usage
--
-- The cabal configuration file should be generated beforehand with
-- cabal configure. If you change your cabal configuration, you
-- will need to recreate the configuration file.
--
-- Launch interactive prompt
--
-- In the root of your haskell project, launch shaker. An interactive
-- prompt will allow you to execute different actions.
--
-- Launch a shaker action from command-line
--
-- In the root of your haskell project, launch shaker with your action as
-- a command argument; shaker will execute the given action and exit. See
-- examples for more details.
--
-- Action execution
--
--
-- - Simple Execution An action can be launched
-- normally, by entering the action name.
-- - Multiple action execution You can specify multiple
-- action to execute simply by separating action by spaces.
-- - Continuous Action A continuous action will execute
-- the action when a file modification has been detected. Every action
-- are elligible to continuous action, you simply need to prefix them
-- with '~'. To stop a continuous action, simply use ^C.
--
--
-- Available actions
--
--
-- - compile Compile the project. Targets of the
-- compilation are main files (in case of executable) and exposed modules
-- (in case of library).
-- - fullcompile Compile all hs files found in source
-- directory. It is usefull to compile test sources. Since it is not
-- possible to compile multiple modules with main, all modules with a
-- main function are excluded.
-- - help Print all available action.
-- - clean Clean the directory containing .o and .hi
-- files.
-- - test Launch all quickcheck properties and hunit
-- tests of the project using test-framework. You can provide a regexp as
-- argument and shaker will execute all tests located in modules matching
-- the regexp. Quickcheck properties and HUnit tests are automatically
-- discovered using GHC Api. All functions begining with “prop_” are
-- considered as quickcheck properties and all functions of type
-- Test.HUnit.Lang.Assertion are considered as HUnit tests.
-- - itest Launch all quickcheck properties and hunit
-- tests using test-framework on compiled modules. Same as test, you can
-- give a regexp as argument. This action is only useful when used with
-- continuous action.
-- - quit Exit the application. You can also use ^C or
-- ^D to exit shaker.
--
--
-- Examples with interactive prompt
--
--
-- - % compile Simply compile the project
-- - % clean compile Clean and compile the project
-- - % ~compile Switch to continuous mode and will
-- compile the project when sources are modified.
-- - % ~clean compile Switch to continuous mode and
-- will clean and compile the project when sources are modified.
-- - % test Execute all tests in the project
-- - % ~itest Switch to continuous mode and execute
-- tests on compiled modules.
-- - % test Regex Launch all tests in modules
-- containing Regex
-- - % ~itest Regex Launch all tests in modules
-- containing Regex only when Regex is build.
--
--
-- Examples with command-line
--
--
-- - % shaker fullcompile Launch shaker, execute the
-- fullcompile action and give back the control.
-- - % shaker "~fullcompile" Launch shaker,
-- continuously execute the fullcompile action until shaker is
-- interrupted.
--
@package shaker
@version 0.4
-- | Allow to filter a list of string with include and exclude patterns
module Shaker.Regex
-- | Filter all elements matching include patterns and remove all elements
-- matching exclude patterns to the result.
--
-- If no include pattern is given, all elements are accepted minus those
-- matching exclude patterns.
--
-- If no exclude pattern is given, all elements matching include patterns
-- are taken.
processListWithRegexp :: [String] -> [String] -> [String] -> [String]
-- | Aggregate all types and data used through shaker
module Shaker.Type
-- | Environnement containing the project configuration. It is generated at
-- startup and won't change
type Shaker = ReaderT ShakerInput
type ShakerR = Reader ShakerInput
type ThreadIdList = MVar [ThreadId]
type Token = MVar Int
-- | Environnement for the project compilation This environnement can
-- change depending on the compile action called
type CompileM = Reader CompileInput
-- | Duration define the life span of an action
data Duration
-- | Execute the action and give back control
OneShot :: Duration
-- | Execute the action when a source file modification is done until it is
-- stopped
Continuous :: Duration
-- | Action represents the differents action with arguments
data Action
Action :: ShakerAction -> Action
ActionWithArg :: ShakerAction -> String -> Action
-- | The input mvar is used to push the parsed command
type Input = MVar (Maybe Command)
data InputState
InputState :: Input -> Token -> InputState
input :: InputState -> Input
-- | Token is used to manage the token between action executor and
-- command-line listener
token :: InputState -> Token
-- | ShakerAction represents the differents actions realisable by shaker
data ShakerAction
-- | Compile sources with ghc
Compile :: ShakerAction
-- | Compile all hs sources with ghc
FullCompile :: ShakerAction
-- | Execute both quickcheck and hunit using test framework
TestFramework :: ShakerAction
-- | Execute both quickcheck and hunit using test framework on recompiled
-- modules
IntelligentTestFramework :: ShakerAction
-- | Display an error when invalid action is inputed
InvalidAction :: ShakerAction
-- | Display the help
Help :: ShakerAction
-- | Execute a command
Execute :: ShakerAction
-- | Nothing to execute
Empty :: ShakerAction
-- | Exit shaker
Quit :: ShakerAction
-- | Delete generated
Clean :: ShakerAction
-- | Command agregate a duration with an action
data Command
Command :: Duration -> [Action] -> Command
-- | Represents the global configuration of the system
data ShakerInput
ShakerInput :: [CompileInput] -> ListenerInput -> PluginMap -> CommandMap -> Maybe String -> [FileInfo] -> ThreadData -> InputState -> ShakerInput
compileInputs :: ShakerInput -> [CompileInput]
listenerInput :: ShakerInput -> ListenerInput
pluginMap :: ShakerInput -> PluginMap
commandMap :: ShakerInput -> CommandMap
argument :: ShakerInput -> Maybe String
modifiedInfoFiles :: ShakerInput -> [FileInfo]
threadData :: ShakerInput -> ThreadData
inputState :: ShakerInput -> InputState
data ThreadData
ThreadData :: Token -> Token -> ThreadIdList -> ThreadIdList -> ThreadData
listenToken :: ThreadData -> Token
quitToken :: ThreadData -> Token
threadIdListenList :: ThreadData -> ThreadIdList
threadIdQuitList :: ThreadData -> ThreadIdList
getListenThreadList :: ShakerInput -> ThreadIdList
-- | Configuration flags to pass to the ghc compiler
data CompileInput
CompileInput :: [String] -> String -> String -> (DynFlags -> DynFlags) -> [String] -> [String] -> CompileInput
-- | Source directory of haskell files
cfSourceDirs :: CompileInput -> [String]
-- | Desctipition of the compile input (executable or library if comming
-- from cabal)
cfDescription :: CompileInput -> String
-- | Destination of .o and .hi files
cfCompileTarget :: CompileInput -> String
-- | A transform fonction wich will takes the DynFlags of the current ghc
-- session and change some values
cfDynFlags :: CompileInput -> (DynFlags -> DynFlags)
-- | The command line to pass options to pass to the ghc compiler
cfCommandLineFlags :: CompileInput -> [String]
-- | List of files or list of modules to compile
cfTargetFiles :: CompileInput -> [String]
-- | Configuration of the continuous listener
data ListenerInput
ListenerInput :: [FileListenInfo] -> Int -> ListenerInput
-- | The files to listen
fileListenInfo :: ListenerInput -> [FileListenInfo]
-- | Delay beetween 2 check in microsecond
delay :: ListenerInput -> Int
-- | Represents directory to listen
data FileListenInfo
FileListenInfo :: FilePath -> [String] -> [String] -> FileListenInfo
-- | location of the listened directory
dir :: FileListenInfo -> FilePath
-- | ignore patterns
ignore :: FileListenInfo -> [String]
-- | include patterns
include :: FileListenInfo -> [String]
-- | Agregate a FilePath with its modification time
data FileInfo
FileInfo :: FilePath -> ClockTime -> FileInfo
fileInfoFilePath :: FileInfo -> FilePath
fileInfoClockTime :: FileInfo -> ClockTime
-- | Represents the mapping beetween an action and the function to execute
type PluginMap = Map ShakerAction Plugin
-- | Represents the mapping between the command-line input and the action
type CommandMap = Map String ShakerAction
-- | Represents an action of shaker
type Plugin = Shaker IO ()
-- | Default compilation argument. Wall is activated by default
defaultCompileInput :: CompileInput
-- | default dynamics flags the sources are expected to be in src as
-- described in
-- http://www.haskell.org/haskellwiki/structure_of_a_haskell_project
-- the result of compilation (.o and .hi) are placed in the target/
-- directory there is no main linkage by default to allow faster
-- compilation feedback
defaultCompileFlags :: DynFlags -> DynFlags
-- | The default Listener configuration Listened sources are all haskell
-- sources in src and testsuite The default delay is 2 sec
defaultListenerInput :: ListenerInput
-- | Default haskell file pattern : *.hs
defaultHaskellPatterns :: [String]
-- | Default exclude pattern : Setup.hs
defaultExclude :: [String]
exitCommand :: Command
emptyCommand :: Command
instance Show FileInfo
instance Eq FileInfo
instance Show FileListenInfo
instance Eq FileListenInfo
instance Show Command
instance Eq Command
instance Show ShakerAction
instance Eq ShakerAction
instance Ord ShakerAction
instance Show Action
instance Eq Action
instance Ord Action
instance Show Duration
instance Eq Duration
instance Show CompileInput
-- | Standard and simple actions
module Shaker.Action.Standard
-- | Print the list of available actions
runHelp :: Plugin
-- | Print exit. The real exit management is made in conductor
runExit :: Plugin
-- | Print a begin action notification
runStartAction :: Plugin
runEmpty :: Plugin
-- | Print an end action notification
runEndAction :: Plugin
-- | Clean action is responsible to delete directory containing temporary
-- .o and .hi files
runClean :: Plugin
runInvalidAction :: Plugin
-- | Manage all file operations like listing files with includes and
-- exclude patterns and file filtering
module Shaker.Io
-- | Get the tuples of (newFiles,modifiedFiles) from given list of
-- directory
listModifiedAndCreatedFiles :: [FileListenInfo] -> [FileInfo] -> IO ([FileInfo], [FileInfo])
-- | List files in the given directory Files matching one regexp in the
-- ignore argument are excluded
listFiles :: FileListenInfo -> IO [FilePath]
-- | Get the list of FileInfo of the given directory
getCurrentFpCl :: FileListenInfo -> IO [FileInfo]
recurseMultipleListFiles :: [FileListenInfo] -> IO [FilePath]
-- | Recursively list all files All non matching files are excluded
recurseListFiles :: FileListenInfo -> IO [FilePath]
isFileContainingMain :: FilePath -> IO Bool
isFileContainingTH :: FilePath -> IO Bool
-- | Default haskell file pattern : *.hs
defaultHaskellPatterns :: [String]
-- | Default exclude pattern : Setup.hs
defaultExclude :: [String]
-- | Utilities function for compilation and haskell file management
module Shaker.SourceHelper
data CompileFile
CompileFile :: FilePath -> Bool -> Bool -> CompileFile
cfFp :: CompileFile -> FilePath
cfHasMain :: CompileFile -> Bool
cfHasTH :: CompileFile -> Bool
-- | Merge source dirs informations from the CompileInput list to create a
-- single CompileInput
mergeCompileInputsSources :: [CompileInput] -> CompileInput
-- | Build the list of haskell source files located in CompileInput source
-- dirs
constructCompileFileList :: CompileInput -> IO [CompileFile]
-- | Configure the CompileInput with all haskell files configured as
-- targets
setAllHsFilesAsTargets :: CompileInput -> CompileR CompileInput
removeFileWithMain :: CompileInput -> CompileR CompileInput
removeFileWithTemplateHaskell :: CompileInput -> CompileR CompileInput
-- | Fill compile input with every haskell files in the project except
-- those containing main and template haskell
fillCompileInputWithStandardTarget :: CompileInput -> CompileR CompileInput
initializeGhc :: (GhcMonad m) => CompileInput -> m ()
-- | Configure and load targets of compilation. It is possible to exploit
-- the compilation result after this step.
ghcCompile :: (GhcMonad m) => CompileInput -> m SuccessFlag
checkUnchangedSources :: [FilePath] -> ModSummary -> IO Bool
-- | Check of the module need to be recompile. Modify ghc session by adding
-- the module iface in the homePackageTable
isModuleNeedCompilation :: (GhcMonad m) => [FilePath] -> ModSummary -> m Bool
instance Show CompileFile
module Shaker.Action.Compile
-- | Run haskell compilation on given CompileInput list
runCompile :: Plugin
-- | Run haskell compilation on all haskell files
runFullCompile :: Plugin
-- | Configure and load targets of compilation. It is possible to exploit
-- the compilation result after this step.
ghcCompile :: (GhcMonad m) => CompileInput -> m SuccessFlag
module Shaker.Reflexivite
-- | Mapping between module name (to import) and test to execute
data ModuleMapping
ModuleMapping :: String -> [String] -> [String] -> ModuleMapping
-- | Complete name of the module
cfModuleName :: ModuleMapping -> String
-- | Hunit test function names
cfHunitName :: ModuleMapping -> [String]
-- | QuickCheck test function names
cfPropName :: ModuleMapping -> [String]
data RunnableFunction
RunnableFunction :: [String] -> String -> RunnableFunction
cfModule :: RunnableFunction -> [String]
cfFunctionName :: RunnableFunction -> String
-- | Collect all non-main modules with their test function associated
collectAllModulesForTest :: Shaker IO [ModuleMapping]
-- | Collect all non-main modules
collectAllModules :: Shaker IO [ModSummary]
-- | Analyze all haskell modules of the project and output all module
-- needing recompilation
collectChangedModules :: Shaker IO [ModSummary]
collectChangedModulesForTest :: Shaker IO [ModuleMapping]
-- | Compile, load and run the given function
runFunction :: RunnableFunction -> Shaker IO ()
-- | Remove all modules which does not contain test
removeNonTestModule :: [ModuleMapping] -> [ModuleMapping]
-- | List all test group of the project. see Shaker.TestTH
listAllTestFrameworkGroupList :: ShakerInput -> ExpQ
-- | Include only module matching the given pattern
filterModulesWithPattern :: Maybe String -> [ModuleMapping] -> [ModuleMapping]
-- | List all test group for test-framework from the list of modules
listTestFrameworkGroupList :: [ModuleMapping] -> ExpQ
instance Show RunnableFunction
instance Show ModuleMapping
instance Eq ModuleMapping
module Shaker.Action.Test
runTestFramework :: Plugin
runIntelligentTestFramework :: Plugin
runTestFramework' :: [ModuleMapping] -> Plugin
module Shaker.Action.Execute
runExecute :: Plugin
launchFunction :: Maybe String -> Plugin
parseModuleAndAction :: String -> RunnableFunction
split :: Char -> String -> [String]
-- | Register available actions and how they will be called
module Shaker.PluginConfig
-- | The default plugin map contains mapping for compile, help and exit
-- action
defaultPluginMap :: PluginMap
defaultCommandMap :: CommandMap
-- | Manage file listener operation for continuous mode. All communication
-- are made via MVars
module Shaker.Listener
-- | listen to the job box and process the job
listen :: CurrentFiles -> MvModifiedFiles -> Job -> IO ()
initializeListener :: Shaker IO ListenState
-- | manage the job box. Fill it with a job every delay
schedule :: ListenerInput -> Job -> IO ()
-- | Update the files status
updateFileStat :: CurrentFiles -> MvModifiedFiles -> [FileInfo] -> [FileInfo] -> IO ()
-- | Agregate all information of listener
data ListenState
ListenState :: CurrentFiles -> MvModifiedFiles -> [ThreadId] -> ListenState
-- | Files found in the last check
currentFiles :: ListenState -> CurrentFiles
-- | Differences between last and before last check
mvModifiedFiles :: ListenState -> MvModifiedFiles
-- | List of all forks id initialized
threadIds :: ListenState -> [ThreadId]
-- | Module responsible to parse a String into a Command
module Shaker.Parser
-- | Parse the given string to a Command
parseCommand :: String -> ShakerInput -> Either ParseError Command
-- | Command line manager This manager will listen to the standard input as
-- soon as the MVar token is filled. Then, it will fill another MVar
-- (input) with the parsed command. Autocompletion is supported throught
-- haskeline configuration.
module Shaker.Cli
-- | Listen to keyboard input and parse command
getInput :: Shaker IO (IO ())
listActions :: (Monad m) => ShakerInput -> String -> m [Completion]
data InputState
InputState :: Input -> Token -> InputState
input :: InputState -> Input
-- | Token is used to manage the token between action executor and
-- command-line listener
token :: InputState -> Token
-- | Conductor is responsible to control the command-line listener, the
-- listener manager and the action to execute
module Shaker.Conductor
-- | Initialize the master thread Once quit is called, all threads are
-- killed
initThread :: Shaker IO ()
-- | Execute Given Command in a new thread
executeCommand :: Maybe Command -> Shaker IO ()
-- | Contains the default configuration of shaker
module Shaker.Config
defaultInput :: ShakerInput
defaultInputInitialized :: IO ShakerInput
defaultThreadData :: IO ThreadData
defaultInputState :: IO InputState
-- | Allow to use cabal configuration (generated via the configure action
-- of cabal). Source directories and compilation options will be reused
-- by Shaker.
module Shaker.Cabal.CabalInfo
-- | Read the build information from cabal and output a shakerInput from it
defaultCabalInput :: IO ShakerInput
-- | Allow to dynamically construct a list of quickcheck properties and
-- Hunit test with template haskell
module Shaker.TestTH
-- | Template for the test group. Currently generate a list of type [Test]
-- with a test group per module
thListTestFramework :: ExpQ