Safe Haskell | None |
---|---|
Language | Haskell2010 |
Debian.Debianize.Prelude
Contents
Description
Functions and instances used by but not related to cabal-debian. These could conceivably be moved into more general libraries.
Synopsis
- 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 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
- 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
- (.?=) :: forall (m :: Type -> Type) a b. Monad m => Lens' a (Maybe b) -> Maybe b -> StateT a m ()
- escapeDebianWildcards :: String -> String
- module Distribution.Version
- data PackageName
- data PackageIdentifier = PackageIdentifier {}
- mkPackageName :: String -> PackageName
- unPackageName :: PackageName -> String
Documentation
type DebMap = Map BinPkgName (Maybe DebianVersion) Source #
buildDebVersionMap :: IO DebMap Source #
Query versions of installed packages
(!) :: DebMap -> BinPkgName -> DebianVersion 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 varlibdpkginfo
.
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.
maybeL :: Lens' a (Maybe b) -> Maybe b -> a -> a Source #
If the current value of view 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).
fromSingleton :: a -> ([a] -> a) -> Set a -> a Source #
(.?=) :: forall (m :: Type -> Type) a 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
escapeDebianWildcards :: String -> String Source #
This should probably be used in a lot of places.
module Distribution.Version
data PackageName #
A package name.
Use mkPackageName
and unPackageName
to convert from/to a
String
.
This type is opaque since Cabal-2.0
Since: Cabal-syntax-2.0.0.2
Instances
data PackageIdentifier #
The name and version of a package.
Constructors
PackageIdentifier | |
Fields
|
Instances
Package PackageIdentifier | |||||
Defined in Distribution.Package Methods | |||||
Parsec PackageIdentifier |
Note: Stricter than
| ||||
Defined in Distribution.Types.PackageId Methods parsec :: CabalParsing m => m PackageIdentifier # | |||||
Pretty PackageIdentifier | |||||
Defined in Distribution.Types.PackageId Methods pretty :: PackageIdentifier -> Doc # prettyVersioned :: CabalSpecVersion -> PackageIdentifier -> Doc # | |||||
Structured PackageIdentifier | |||||
Defined in Distribution.Types.PackageId Methods structure :: Proxy PackageIdentifier -> Structure # structureHash' :: Tagged PackageIdentifier MD5 | |||||
Data PackageIdentifier | |||||
Defined in Distribution.Types.PackageId Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PackageIdentifier -> c PackageIdentifier # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PackageIdentifier # toConstr :: PackageIdentifier -> Constr # dataTypeOf :: PackageIdentifier -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PackageIdentifier) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PackageIdentifier) # gmapT :: (forall b. Data b => b -> b) -> PackageIdentifier -> PackageIdentifier # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PackageIdentifier -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PackageIdentifier -> r # gmapQ :: (forall d. Data d => d -> u) -> PackageIdentifier -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> PackageIdentifier -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> PackageIdentifier -> m PackageIdentifier # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PackageIdentifier -> m PackageIdentifier # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PackageIdentifier -> m PackageIdentifier # | |||||
Generic PackageIdentifier | |||||
Defined in Distribution.Types.PackageId Associated Types
Methods from :: PackageIdentifier -> Rep PackageIdentifier x # to :: Rep PackageIdentifier x -> PackageIdentifier # | |||||
Read PackageIdentifier | |||||
Defined in Distribution.Types.PackageId Methods readsPrec :: Int -> ReadS PackageIdentifier # readList :: ReadS [PackageIdentifier] # | |||||
Show PackageIdentifier | |||||
Defined in Distribution.Types.PackageId Methods showsPrec :: Int -> PackageIdentifier -> ShowS # show :: PackageIdentifier -> String # showList :: [PackageIdentifier] -> ShowS # | |||||
Binary PackageIdentifier | |||||
Defined in Distribution.Types.PackageId Methods put :: PackageIdentifier -> Put # get :: Get PackageIdentifier # putList :: [PackageIdentifier] -> Put # | |||||
NFData PackageIdentifier | |||||
Defined in Distribution.Types.PackageId Methods rnf :: PackageIdentifier -> () # | |||||
Eq PackageIdentifier | |||||
Defined in Distribution.Types.PackageId Methods (==) :: PackageIdentifier -> PackageIdentifier -> Bool # (/=) :: PackageIdentifier -> PackageIdentifier -> Bool # | |||||
Ord PackageIdentifier | |||||
Defined in Distribution.Types.PackageId Methods compare :: PackageIdentifier -> PackageIdentifier -> Ordering # (<) :: PackageIdentifier -> PackageIdentifier -> Bool # (<=) :: PackageIdentifier -> PackageIdentifier -> Bool # (>) :: PackageIdentifier -> PackageIdentifier -> Bool # (>=) :: PackageIdentifier -> PackageIdentifier -> Bool # max :: PackageIdentifier -> PackageIdentifier -> PackageIdentifier # min :: PackageIdentifier -> PackageIdentifier -> PackageIdentifier # | |||||
Pretty (PP PackageIdentifier) Source # | |||||
Defined in Debian.Debianize.Prelude Methods pretty :: PP PackageIdentifier -> Doc # prettyVersioned :: CabalSpecVersion -> PP PackageIdentifier -> Doc # | |||||
type Rep PackageIdentifier | |||||
Defined in Distribution.Types.PackageId type Rep PackageIdentifier = D1 ('MetaData "PackageIdentifier" "Distribution.Types.PackageId" "Cabal-syntax-3.10.3.0-dc3a" 'False) (C1 ('MetaCons "PackageIdentifier" 'PrefixI 'True) (S1 ('MetaSel ('Just "pkgName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageName) :*: S1 ('MetaSel ('Just "pkgVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Version))) |
mkPackageName :: String -> PackageName #
Construct a PackageName
from a String
mkPackageName
is the inverse to unPackageName
Note: No validations are performed to ensure that the resulting
PackageName
is valid
Since: Cabal-syntax-2.0.0.2
unPackageName :: PackageName -> String #
Convert PackageName
to String
Orphan instances
Pretty (PP PackageIdentifier) Source # | |
Methods pretty :: PP PackageIdentifier -> Doc # prettyVersioned :: CabalSpecVersion -> PP PackageIdentifier -> Doc # | |
Pretty (PP PackageName) Source # | |
Methods pretty :: PP PackageName -> Doc # prettyVersioned :: CabalSpecVersion -> PP PackageName -> Doc # |