module-management-0.20.3: Clean up module imports, split and merge modules

Safe HaskellSafe-Inferred
LanguageHaskell98

Language.Haskell.Modules.SourceDirs

Synopsis

Documentation

class (MonadIO m, MonadBaseControl IO m) => SourceDirs m where Source

Methods

putDirs :: [FilePath] -> m () Source

Set the list of directories that will be searched for imported modules. Similar to the Hs-Source-Dirs field in the cabal file.

getDirs :: m [FilePath] Source

Instances

modifyDirs :: SourceDirs m => ([FilePath] -> [FilePath]) -> m () Source

Modify the list of directories that will be searched for imported modules.

withDirs :: SourceDirs m => [FilePath] -> m a -> m a Source

newtype RelPath Source

A FilePath that is relative to the SourceDir list

Constructors

RelPath 

Fields

unRelPath :: FilePath
 

newtype PathKey Source

A FilePath that can be assumed to be unique.

Constructors

PathKey 

Fields

unPathKey :: FilePath
 

newtype APath Source

A regular filepath with a wrapper

Constructors

APath 

Fields

unAPath :: FilePath
 

pathKey :: (SourceDirs m, Path p, Show p) => p -> m PathKey Source

class Path a where Source

modulePath :: SourceDirs m => String -> ModuleName -> m APath Source

Search the path directory list, preferring an already existing file, but if there is none construct one using the first element of the directory list.

modulePathBase :: String -> ModuleName -> RelPath Source

Derive a relative FilePath from a module name based on the file type inferred by the extension. Thus, modulePathBase "hs" (ModuleName System.Control.Monad) returns "SystemControlMonad.hs", while modulePathBase "imports" (ModuleName System.Control.Monad) returns "System.Control.Monad.imports".