Safe Haskell | None |
---|---|
Language | Haskell98 |
Combinators for a compile run. 20150807: experimental version, to provide with a forwarding mechanism for renamed compile units. As of now does not work with UHC, suspect a non intented name capture
- class (CompileModName nm, CompileUnitState state, CompileUnit unit nm loc state, CompileRunError err pos, CompileRunStateInfo info nm pos, MonadState (CompileRun nm unit info err) m, MonadIO m, Monad m) => CompileRunner state nm pos loc unit info err m
- data CompileRunState err
- = CRSOk
- | CRSFail
- | CRSFailMsg String
- | CRSStopSeq
- | CRSStopAllSeq
- | CRSStop
- | CRSFailErrL String [err] (Maybe Int)
- | CRSErrInfoL String Bool [err]
- data CompileRun nm unit info err = CompileRun {
- _crCUCache :: Map nm unit
- _crNmForward :: Map nm nm
- _crCompileOrder :: [[nm]]
- _crTopModNm :: nm
- _crState :: CompileRunState err
- _crStateInfo :: info
- _crOutputDebug :: Bool
- crCUCache :: forall cat nm unit info err. ArrowApply cat => Lens cat (CompileRun nm unit info err) (Map nm unit)
- crCompileOrder :: forall cat nm unit info err. ArrowApply cat => Lens cat (CompileRun nm unit info err) [[nm]]
- crTopModNm :: forall cat nm unit info err. ArrowApply cat => Lens cat (CompileRun nm unit info err) nm
- crState :: forall cat nm unit info err a. ArrowApply cat => Lens cat (CompileRun nm unit info err -> CompileRun nm unit info a) (CompileRunState err -> CompileRunState a)
- crStateInfo :: forall cat nm unit info err a. ArrowApply cat => Lens cat (CompileRun nm unit info err -> CompileRun nm unit a err) (info -> a)
- crNmForward :: forall cat nm unit info err. ArrowApply cat => Lens cat (CompileRun nm unit info err) (Map nm nm)
- type CompilePhase n u i e a = CompilePhaseT n u i e Identity a
- data CompilePhaseT n u i e m a
- class CompileUnit u n l s | u -> n l s where
- class CompileUnitState s where
- class CompileRunError e p | e -> p where
- class CompileModName n where
- class CompileRunStateInfo i n p where
- data CompileParticipation = CompileParticipation_NoImport
- class FileLocatable x loc | loc -> x where
- mkEmptyCompileRun :: n -> i -> CompileRun n u i e
- crCU :: (Show n, Ord n) => n -> CompileRun n u i e -> u
- crMbCU :: Ord n => n -> CompileRun n u i e -> Maybe u
- crMbCUNotForwarded :: Ord n => n -> CompileRun n u i e -> Maybe u
- crMbCUForwarded :: Ord n => n -> CompileRun n u i e -> Maybe u
- ppCR :: (PP n, PP u) => CompileRun n u i e -> PP_Doc
- cpUpdStateInfo :: CompileRunner s n p l u i e m => (i -> i) -> CompilePhaseT n u i e m ()
- cpUpdSI :: CompileRunner s n p l u i e m => (i -> i) -> CompilePhaseT n u i e m ()
- cpUpdCU :: (Show n, Ord n, CompileRunner s n p l u i e m) => n -> (u -> u) -> CompilePhaseT n u i e m ()
- cpUpdCUWithKey :: (Show n, Ord n, CompileRunner s n p l u i e m) => n -> (n -> u -> (n, u)) -> CompilePhaseT n u i e m n
- cpMbCU :: (Ord n, CompileRunner s n p l u i e m) => n -> CompilePhaseT n u i e m (Maybe u)
- cpSetFail :: CompileRunner s n p l u i e m => CompilePhaseT n u i e m ()
- cpSetStop :: CompileRunner s n p l u i e m => CompilePhaseT n u i e m ()
- cpSetStopSeq :: CompileRunner s n p l u i e m => CompilePhaseT n u i e m ()
- cpSetStopAllSeq :: CompileRunner s n p l u i e m => CompilePhaseT n u i e m ()
- cpSetOk :: CompileRunner s n p l u i e m => CompilePhaseT n u i e m ()
- cpSetErrs :: CompileRunner s n p l u i e m => [e] -> CompilePhaseT n u i e m ()
- cpSetLimitErrs :: CompileRunner s n p l u i e m => Int -> String -> [e] -> CompilePhaseT n u i e m ()
- cpSetLimitErrsWhen :: CompileRunner s n p l u i e m => Int -> String -> [e] -> CompilePhaseT n u i e m ()
- cpSetInfos :: CompileRunner s n p l u i e m => String -> Bool -> [e] -> CompilePhaseT n u i e m ()
- cpSetCompileOrder :: CompileRunner s n p l u i e m => [[n]] -> CompilePhaseT n u i e m ()
- cpSeq :: CompileRunner s n p l u i e m => [CompilePhaseT n u i e m ()] -> CompilePhaseT n u i e m ()
- cpSeqWhen :: CompileRunner s n p l u i e m => Bool -> [CompilePhaseT n u i e m ()] -> CompilePhaseT n u i e m ()
- cpEmpty :: CompileRunner s n p l u i e m => CompilePhaseT n u i e m ()
- cpFindFileForNameOrFPath :: FPATH n => String -> n -> FPath -> [(String, FPath)]
- cpFindFilesForFPathInLocations :: (Ord n, Show n, FPATH n, FileLocatable u loc, Show loc, CompileRunner s n p loc u i e m) => (loc -> n -> FPath -> [(loc, FPath, [e])]) -> ((FPath, loc, [e]) -> res) -> Bool -> [(FileSuffix, s)] -> [loc] -> Maybe n -> Maybe FPath -> CompilePhaseT n u i e m [res]
- cpFindFilesForFPath :: forall e n u p i s m. (Ord n, Show n, FPATH n, FileLocatable u String, CompileRunner s n p String u i e m) => Bool -> [(FileSuffix, s)] -> [String] -> Maybe n -> Maybe FPath -> CompilePhaseT n u i e m [FPath]
- cpFindFileForFPath :: (Ord n, Show n, FPATH n, FileLocatable u String, CompileRunner s n p String u i e m) => [(FileSuffix, s)] -> [String] -> Maybe n -> Maybe FPath -> CompilePhaseT n u i e m (Maybe FPath)
- cpImportGather :: (Show n, Ord n, CompileRunner s n p l u i e m) => (n -> CompilePhaseT n u i e m ()) -> n -> CompilePhaseT n u i e m ()
- cpImportGatherFromMods :: (Show n, Ord n, CompileRunner s n p l u i e m) => (Maybe prev -> n -> CompilePhaseT n u i e m (x, Maybe prev)) -> [n] -> CompilePhaseT n u i e m ()
- cpImportGatherFromModsWithImp :: (Show n, Ord n, CompileRunner s n p l u i e m) => (u -> [n]) -> (Maybe prev -> n -> CompilePhaseT n u i e m (x, Maybe prev)) -> [n] -> CompilePhaseT n u i e m ()
- cpPP :: (PP n, PP u, CompileRunner s n p l u i e m) => String -> CompilePhaseT n u i e m ()
- cpPPMsg :: (PP msg, CompileRunner s n p l u i e m) => msg -> CompilePhaseT n u i e m ()
- forgetM :: Monad m => m a -> m ()
Documentation
class (CompileModName nm, CompileUnitState state, CompileUnit unit nm loc state, CompileRunError err pos, CompileRunStateInfo info nm pos, MonadState (CompileRun nm unit info err) m, MonadIO m, Monad m) => CompileRunner state nm pos loc unit info err m Source #
Class alias for compile functionality
data CompileRunState err Source #
CRSOk | |
CRSFail | |
CRSFailMsg String | |
CRSStopSeq | |
CRSStopAllSeq | |
CRSStop | |
CRSFailErrL String [err] (Maybe Int) | |
CRSErrInfoL String Bool [err] |
Show (CompileRunState err) Source # | |
Error (CompileRunState err) Source # | |
data CompileRun nm unit info err Source #
CompileRun | |
|
crCUCache :: forall cat nm unit info err. ArrowApply cat => Lens cat (CompileRun nm unit info err) (Map nm unit) Source #
crCompileOrder :: forall cat nm unit info err. ArrowApply cat => Lens cat (CompileRun nm unit info err) [[nm]] Source #
crTopModNm :: forall cat nm unit info err. ArrowApply cat => Lens cat (CompileRun nm unit info err) nm Source #
crState :: forall cat nm unit info err a. ArrowApply cat => Lens cat (CompileRun nm unit info err -> CompileRun nm unit info a) (CompileRunState err -> CompileRunState a) Source #
crStateInfo :: forall cat nm unit info err a. ArrowApply cat => Lens cat (CompileRun nm unit info err -> CompileRun nm unit a err) (info -> a) Source #
crNmForward :: forall cat nm unit info err. ArrowApply cat => Lens cat (CompileRun nm unit info err) (Map nm nm) Source #
type CompilePhase n u i e a = CompilePhaseT n u i e Identity a Source #
data CompilePhaseT n u i e m a Source #
CompileRun
as state in specific StateT variant with non standard >>=
newtype CompilePhaseT n u i e m a = CompilePhaseT {runCompilePhaseT :: CompileRun n u i e -> m (a, CompileRun n u i e)}
(CompileRunner state n pos loc u i e m, MonadState s m) => MonadState s (CompilePhaseT n u i e m) Source # | |
(CompileRunner state n pos loc u i e m, MonadError e' m) => MonadError e' (CompilePhaseT n u i e m) Source # | |
MonadTrans (CompilePhaseT n u i e) Source # | |
CompileRunner state n pos loc u i e m => Monad (CompilePhaseT n u i e m) Source # | |
CompileRunner state n pos loc u i e m => Functor (CompilePhaseT n u i e m) Source # | |
(CompileRunner state n pos loc u i e m, MonadFix m) => MonadFix (CompilePhaseT n u i e m) Source # | |
CompileRunner state n pos loc u i e m => Applicative (CompilePhaseT n u i e m) Source # | |
(CompileRunner state n pos loc u i e m, MonadIO m) => MonadIO (CompilePhaseT n u i e m) Source # | |
class CompileUnit u n l s | u -> n l s where Source #
Per compile unit
cuDefault, cuFPath, cuUpdFPath, cuLocation, cuUpdLocation, cuKey, cuUpdKey, cuState, cuUpdState, cuImports
cuFPath :: u -> FPath Source #
cuUpdFPath :: FPath -> u -> u Source #
cuLocation :: u -> l Source #
cuUpdLocation :: l -> u -> u Source #
cuUpdKey :: n -> u -> u Source #
cuUpdState :: s -> u -> u Source #
cuImports :: u -> [n] Source #
cuParticipation :: u -> [CompileParticipation] Source #
class CompileUnitState s where Source #
State of a compile unit
class CompileRunError e p | e -> p where Source #
Error reporting
crePPErrL :: [e] -> PP_Doc Source #
creMkNotFoundErrL :: p -> String -> [String] -> [FileSuffix] -> [e] Source #
creAreFatal :: [e] -> Bool Source #
class CompileModName n where Source #
Conversion from string to module name
class CompileRunStateInfo i n p where Source #
crsiImportPosOfCUKey :: n -> i -> p Source #
data CompileParticipation Source #
class FileLocatable x loc | loc -> x where Source #
fileLocation :: x -> loc Source #
noFileLocation :: loc Source #
mkEmptyCompileRun :: n -> i -> CompileRun n u i e Source #
crMbCUNotForwarded :: Ord n => n -> CompileRun n u i e -> Maybe u Source #
crMbCUForwarded :: Ord n => n -> CompileRun n u i e -> Maybe u Source #
cpUpdStateInfo :: CompileRunner s n p l u i e m => (i -> i) -> CompilePhaseT n u i e m () Source #
cpUpdSI :: CompileRunner s n p l u i e m => (i -> i) -> CompilePhaseT n u i e m () Source #
cpUpdCU :: (Show n, Ord n, CompileRunner s n p l u i e m) => n -> (u -> u) -> CompilePhaseT n u i e m () Source #
cpUpdCUWithKey :: (Show n, Ord n, CompileRunner s n p l u i e m) => n -> (n -> u -> (n, u)) -> CompilePhaseT n u i e m n Source #
cpMbCU :: (Ord n, CompileRunner s n p l u i e m) => n -> CompilePhaseT n u i e m (Maybe u) Source #
lookup unit
cpSetFail :: CompileRunner s n p l u i e m => CompilePhaseT n u i e m () Source #
cpSetStop :: CompileRunner s n p l u i e m => CompilePhaseT n u i e m () Source #
cpSetStopSeq :: CompileRunner s n p l u i e m => CompilePhaseT n u i e m () Source #
cpSetStopAllSeq :: CompileRunner s n p l u i e m => CompilePhaseT n u i e m () Source #
cpSetOk :: CompileRunner s n p l u i e m => CompilePhaseT n u i e m () Source #
cpSetErrs :: CompileRunner s n p l u i e m => [e] -> CompilePhaseT n u i e m () Source #
cpSetLimitErrs :: CompileRunner s n p l u i e m => Int -> String -> [e] -> CompilePhaseT n u i e m () Source #
cpSetLimitErrsWhen :: CompileRunner s n p l u i e m => Int -> String -> [e] -> CompilePhaseT n u i e m () Source #
cpSetInfos :: CompileRunner s n p l u i e m => String -> Bool -> [e] -> CompilePhaseT n u i e m () Source #
cpSetCompileOrder :: CompileRunner s n p l u i e m => [[n]] -> CompilePhaseT n u i e m () Source #
cpSeq :: CompileRunner s n p l u i e m => [CompilePhaseT n u i e m ()] -> CompilePhaseT n u i e m () Source #
cpSeqWhen :: CompileRunner s n p l u i e m => Bool -> [CompilePhaseT n u i e m ()] -> CompilePhaseT n u i e m () Source #
cpEmpty :: CompileRunner s n p l u i e m => CompilePhaseT n u i e m () Source #
cpFindFilesForFPathInLocations Source #
:: (Ord n, Show n, FPATH n, FileLocatable u loc, Show loc, CompileRunner s n p loc u i e m) | |
=> (loc -> n -> FPath -> [(loc, FPath, [e])]) | get the locations for a name, possibly with errors |
-> ((FPath, loc, [e]) -> res) | construct a result given a found location |
-> Bool | stop when first is found |
-> [(FileSuffix, s)] | suffix info |
-> [loc] | locations to search |
-> Maybe n | possibly a module name |
-> Maybe FPath | possibly a file path |
-> CompilePhaseT n u i e m [res] |
cpFindFilesForFPath :: forall e n u p i s m. (Ord n, Show n, FPATH n, FileLocatable u String, CompileRunner s n p String u i e m) => Bool -> [(FileSuffix, s)] -> [String] -> Maybe n -> Maybe FPath -> CompilePhaseT n u i e m [FPath] Source #
cpFindFileForFPath :: (Ord n, Show n, FPATH n, FileLocatable u String, CompileRunner s n p String u i e m) => [(FileSuffix, s)] -> [String] -> Maybe n -> Maybe FPath -> CompilePhaseT n u i e m (Maybe FPath) Source #
cpImportGather :: (Show n, Ord n, CompileRunner s n p l u i e m) => (n -> CompilePhaseT n u i e m ()) -> n -> CompilePhaseT n u i e m () Source #
Abbreviation for cpImportGatherFromMods for 1 module
cpImportGatherFromMods :: (Show n, Ord n, CompileRunner s n p l u i e m) => (Maybe prev -> n -> CompilePhaseT n u i e m (x, Maybe prev)) -> [n] -> CompilePhaseT n u i e m () Source #
recursively extract imported modules
cpImportGatherFromModsWithImp :: (Show n, Ord n, CompileRunner s n p l u i e m) => (u -> [n]) -> (Maybe prev -> n -> CompilePhaseT n u i e m (x, Maybe prev)) -> [n] -> CompilePhaseT n u i e m () Source #
recursively extract imported modules, providing a way to import + do the import
cpPP :: (PP n, PP u, CompileRunner s n p l u i e m) => String -> CompilePhaseT n u i e m () Source #
cpPPMsg :: (PP msg, CompileRunner s n p l u i e m) => msg -> CompilePhaseT n u i e m () Source #