Safe Haskell | None |
---|---|

Language | Haskell98 |

Functions and instances used by but not related to cabal-debian. These could conceivably be moved into more general libraries.

- curry3 :: ((a, b, c) -> d) -> a -> b -> c -> d
- type DebMap = Map BinPkgName (Maybe DebianVersion)
- buildDebVersionMap :: IO DebMap
- (!) :: DebMap -> BinPkgName -> DebianVersion
- strip :: String -> String
- stripWith :: (a -> Bool) -> [a] -> [a]
- strictReadF :: (Text -> r) -> FilePath -> IO r
- replaceFile :: FilePath -> String -> IO ()
- modifyFile :: FilePath -> (String -> IO (Maybe String)) -> IO ()
- diffFile :: FilePath -> Text -> IO (Maybe String)
- removeIfExists :: FilePath -> IO ()
- dpkgFileMap :: IO (Map FilePath (Set BinPkgName))
- debOfFile :: FilePath -> ReaderT (Map FilePath (Set BinPkgName)) IO (Maybe BinPkgName)
- cond :: t -> t -> Bool -> t
- readFile' :: FilePath -> IO Text
- readFileMaybe :: FilePath -> IO (Maybe Text)
- showDeps :: Relations -> String
- showDeps' :: Relations -> String
- withCurrentDirectory :: FilePath -> IO a -> IO a
- getDirectoryContents' :: FilePath -> IO [FilePath]
- setMapMaybe :: (Ord a, Ord b) => (a -> Maybe b) -> Set a -> Set b
- zipMaps :: Ord k => (k -> Maybe a -> Maybe b -> Maybe c) -> Map k a -> Map k b -> Map k c
- foldEmpty :: r -> ([a] -> r) -> [a] -> r
- maybeL :: Lens a (Maybe b) -> Maybe b -> a -> a
- indent :: [Char] -> String -> String
- maybeRead :: Read a => String -> Maybe a
- read' :: Read a => (String -> a) -> String -> a
- modifyM :: MonadState a m => (a -> m a) -> m ()
- intToVerbosity' :: Int -> Verbosity
- (~=) :: Monad m => Lens a b -> b -> StateT a m ()
- (~?=) :: Monad m => Lens a (Maybe b) -> Maybe b -> StateT a m ()
- (%=) :: Monad m => Lens a b -> (b -> b) -> StateT a m ()
- (+=) :: (Monad m, Ord b) => Lens a (Set b) -> b -> StateT a m ()
- (++=) :: (Monad m, Ord b) => Lens a (Map b c) -> (b, c) -> StateT a m ()
- (+++=) :: (Monad m, Ord b, Monoid c) => Lens a (Map b c) -> (b, c) -> StateT a m ()
- listElemLens :: (a -> Bool) -> Lens [a] (Maybe a)
- maybeLens :: a -> Lens a b -> Lens (Maybe a) b
- fromEmpty :: Set a -> Set a -> Set a
- fromSingleton :: a -> ([a] -> a) -> Set a -> a

# Documentation

type DebMap = Map BinPkgName (Maybe DebianVersion) Source

buildDebVersionMap :: IO DebMap Source

Read and parse the status file for installed debian packages: *var*lib*dpkg*status

(!) :: DebMap -> BinPkgName -> DebianVersion Source

strictReadF :: (Text -> r) -> FilePath -> IO r Source

replaceFile :: FilePath -> String -> IO () Source

Write a file which we might still be reading from in order to compute the text argument.

modifyFile :: FilePath -> (String -> IO (Maybe String)) -> IO () Source

Compute the new file contents from the old. If f returns Nothing do not write.

removeIfExists :: FilePath -> IO () Source

dpkgFileMap :: IO (Map FilePath (Set BinPkgName)) Source

Create a map from pathname to the names of the packages that contains that pathname using the
contents of the debian package info directory

.*var*lib*dpkg*info

debOfFile :: FilePath -> ReaderT (Map FilePath (Set BinPkgName)) IO (Maybe BinPkgName) Source

Given a path, return the name of the package that owns it.

withCurrentDirectory :: FilePath -> IO a -> IO a Source

From Darcs.Utils - set the working directory and run an IO operation.

getDirectoryContents' :: FilePath -> IO [FilePath] Source

Get directory contents minus dot files.

maybeL :: Lens a (Maybe b) -> Maybe b -> a -> a Source

If the current value of getL x is Nothing, replace it with f.

modifyM :: MonadState a m => (a -> m a) -> m () Source

intToVerbosity' :: Int -> Verbosity Source

Version of `intToVerbosity`

that first
clamps its argument to the acceptable range (0-3).

(~=) :: Monad m => Lens a b -> b -> StateT a m () Source

Set a lens value. (This is a version of Data.Lens.Lazy.~= that returns () instead of b.)

(~?=) :: Monad m => Lens a (Maybe b) -> Maybe b -> StateT a m () Source

Set `b`

if it currently isNothing and the argument isJust, that is
1. Nothing happens if the argument isNothing
2. Nothing happens if the current value isJust

(%=) :: Monad m => Lens a b -> (b -> b) -> StateT a m () Source

Modify a value. (This is a version of Data.Lens.Lazy.%= that returns () instead of a.)

(+=) :: (Monad m, Ord b) => Lens a (Set b) -> b -> StateT a m () Source

Insert an element into a `(Set b)`

(++=) :: (Monad m, Ord b) => Lens a (Map b c) -> (b, c) -> StateT a m () Source

Insert an element into a `(Map b c)`

(+++=) :: (Monad m, Ord b, Monoid c) => Lens a (Map b c) -> (b, c) -> StateT a m () Source

Insert an element into a `(Map b (Set c))`

listElemLens :: (a -> Bool) -> Lens [a] (Maybe a) Source

fromSingleton :: a -> ([a] -> a) -> Set a -> a Source