plugins-1.4.1: Dynamic linking for Haskell and C objectsSource codeContentsIndex
System.Plugins.Utils
Synopsis
type Arg = String
hWrite :: Handle -> String -> IO ()
mkUnique :: IO FilePath
hMkUnique :: IO (FilePath, Handle)
mkUniqueIn :: FilePath -> IO FilePath
hMkUniqueIn :: FilePath -> IO (FilePath, Handle)
findFile :: [String] -> FilePath -> IO (Maybe FilePath)
mkTemp :: IO (String, Handle)
mkTempIn :: String -> IO (String, Handle)
replaceSuffix :: FilePath -> String -> FilePath
outFilePath :: FilePath -> [Arg] -> (FilePath, FilePath)
dropSuffix :: FilePath -> FilePath
mkModid :: String -> String
changeFileExt :: FilePath -> String -> FilePath
joinFileExt :: String -> String -> FilePath
splitFileExt :: FilePath -> (String, String)
isSublistOf :: Eq a => [a] -> [a] -> Bool
dirname :: FilePath -> FilePath
basename :: FilePath -> FilePath
(</>) :: FilePath -> FilePath -> FilePath
(<.>) :: FilePath -> FilePath -> FilePath
(<+>) :: FilePath -> FilePath -> FilePath
(<>) :: FilePath -> FilePath -> FilePath
newer :: FilePath -> FilePath -> IO Bool
encode :: String -> EncodedString
decode :: EncodedString -> String
type EncodedString = String
panic
Documentation
type Arg = StringSource
hWrite :: Handle -> String -> IO ()Source

useful

writeFile for Handles

mkUnique :: IO FilePathSource

Get a new temp file, unique from those in /tmp, and from those modules already loaded. Very nice for merge/eval uses.

Will run for a long time if we can't create a temp file, luckily mkstemps gives us a pretty big search space

hMkUnique :: IO (FilePath, Handle)Source
mkUniqueIn :: FilePath -> IO FilePathSource
hMkUniqueIn :: FilePath -> IO (FilePath, Handle)Source
findFile :: [String] -> FilePath -> IO (Maybe FilePath)Source
mkTemp :: IO (String, Handle)Source
create a new temp file, returning name and handle. bit like the mktemp shell utility
mkTempIn :: String -> IO (String, Handle)Source
replaceSuffix :: FilePath -> String -> FilePathSource

return the object file, given the .conf file i.e. homedonsfoo.rc -> homedonsfoo.o

we depend on the suffix we are given having a lead .

outFilePath :: FilePath -> [Arg] -> (FilePath, FilePath)Source
dropSuffix :: FilePath -> FilePathSource
mkModid :: String -> StringSource
work out the mod name from a filepath
changeFileExtSource
:: FilePathThe path information to modify.
-> StringThe new extension (without a leading period). Specify an empty string to remove an existing extension from path.
-> FilePathA string containing the modified path information.
Changes the extension of a file path.
joinFileExt :: String -> String -> FilePathSource

The joinFileExt function is the opposite of splitFileExt. It joins a file name and an extension to form a complete file path.

The general rule is:

 filename `joinFileExt` ext == path
   where
     (filename,ext) = splitFileExt path
splitFileExt :: FilePath -> (String, String)Source

Split the path into file name and extension. If the file doesn't have extension, the function will return empty string. The extension doesn't include a leading period.

Examples:

 splitFileExt "foo.ext" == ("foo", "ext")
 splitFileExt "foo"     == ("foo", "")
 splitFileExt "."       == (".",   "")
 splitFileExt ".."      == ("..",  "")
 splitFileExt "foo.bar."== ("foo.bar.", "")
isSublistOf :: Eq a => [a] -> [a] -> BoolSource
dirname :: FilePath -> FilePathSource
dirname : return the directory portion of a file path if null, return .
basename :: FilePath -> FilePathSource
basename : return the filename portion of a path
(</>) :: FilePath -> FilePath -> FilePathSource
(<.>) :: FilePath -> FilePath -> FilePathSource
/>, <. : join two path components
(<+>) :: FilePath -> FilePath -> FilePathSource
(<>) :: FilePath -> FilePath -> FilePathSource
newer :: FilePath -> FilePath -> IO BoolSource

is file1 newer than file2?

needs some fixing to work with 6.0.x series. (is this true?)

fileExist still seems to throw exceptions on some platforms: ia64 in particular.

invarient : we already assume the first file, a, exists

encode :: String -> EncodedStringSource
decode :: EncodedString -> StringSource
type EncodedString = StringSource

return the Z-Encoding of the string.

Stolen from GHC. Use -package ghc as soon as possible

panic
Produced by Haddock version 2.4.2