Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
extract info from cabal files and .tgz names.
Synopsis
- rstrip :: String -> String
- lstrip :: String -> String
- replace :: Eq a => [a] -> [a] -> [a] -> [a]
- takeWhileEnd :: (a -> Bool) -> [a] -> [a]
- spanEnd :: (a -> Bool) -> [a] -> ([a], [a])
- breakEnd :: (a -> Bool) -> [a] -> ([a], [a])
- findCabal :: IO (Maybe FilePath)
- readCabal :: IO String
- extractCabal :: String -> String -> String
- parseTgzFilename :: (IsString s, MonadError s m) => FilePath -> m (IsDocumentation, Package)
- parseTgzFilename' :: IsString s => FilePath -> Either s (IsDocumentation, Package)
- data Upload = Upload {}
- data Package = Package {}
- data IsDocumentation
- data IsCandidate
Documentation
replace :: Eq a => [a] -> [a] -> [a] -> [a] Source #
Replace a subsequence everywhere it occurs. The first argument must not be the empty list.
from NDM's extra-1.5.1
>>>
replace "el" "_" "Hello Bella" == "H_lo B_la"
True>>>
replace "el" "e" "Hello" == "Helo"
True
\xs ys -> not (null xs) ==> replace xs xs ys == ys replace "" "e" "Hello" == undefined
takeWhileEnd :: (a -> Bool) -> [a] -> [a] Source #
Like dropWhileEnd
, but for take
.
(taken from filepath-1.4.1.1)
>>>
takeWhileEnd (< 10) [1, 2, 10, 3, 4, -3]
[3,4,-3]
spanEnd :: (a -> Bool) -> [a] -> ([a], [a]) Source #
like span
, but from the end
>>>
spanEnd (< 3) [4,3,2,1,4,3,2,1]
([4,3,2,1,4,3],[2,1])>>>
spanEnd (< 9) [1,2,3]
([],[1,2,3])>>>
spanEnd (< 0) [1,2,3]
([1,2,3],[])
breakEnd :: (a -> Bool) -> [a] -> ([a], [a]) Source #
like break
, but from the end
>>>
breakEnd (> 3) [4,3,2,1,4,3,2,1]
([4,3,2,1,4],[3,2,1])>>>
breakEnd (< 9) [1,2,3]
([1,2,3],[])>>>
breakEnd (> 9) [1,2,3]
([],[1,2,3])
findCabal :: IO (Maybe FilePath) Source #
if there's a .cabal file in the current dir, return its file name.
from NDM's neil-0.10
readCabal :: IO String Source #
find & read contents of Cabal file from current dir, if it exists. else returns empty string.
from NDM's neil-0.10
extractCabal :: String -> String -> String Source #
extractCabal fieldName cabalConts
:
extract contents of field named fieldName
from a Cabal file string.
field name is case-insensitive [folded to lowercase]
from NDM's neil-0.10
parseTgzFilename :: (IsString s, MonadError s m) => FilePath -> m (IsDocumentation, Package) Source #
Inspect the name of a .tar.gz file to work out the package name and version it's for, and whether it is for documentation or a package.
parseTgzFilename' :: IsString s => FilePath -> Either s (IsDocumentation, Package) Source #
parseTgzFilename'
specialized to Either
.
>>>
(parseTgzFilename' "foo-bar-baz-0.1.0.0.2.3.0.1.tar.gz") :: Either String (IsDocumentation, Package)
Right (IsPackage,Package {packageName = "foo-bar-baz", packageVersion = "0.1.0.0.2.3.0.1"})
Bundle together information useful for an upload.
Upload | |
|
name and version of a package
data IsDocumentation Source #
are we uploading a package or just docs
Instances
Eq IsDocumentation Source # | |
Defined in Distribution.Hup.Types (==) :: IsDocumentation -> IsDocumentation -> Bool # (/=) :: IsDocumentation -> IsDocumentation -> Bool # | |
Read IsDocumentation Source # | |
Defined in Distribution.Hup.Types | |
Show IsDocumentation Source # | |
Defined in Distribution.Hup.Types showsPrec :: Int -> IsDocumentation -> ShowS # show :: IsDocumentation -> String # showList :: [IsDocumentation] -> ShowS # |
data IsCandidate Source #
whether a package is a normal one or a candidate
Instances
Eq IsCandidate Source # | |
Defined in Distribution.Hup.Types (==) :: IsCandidate -> IsCandidate -> Bool # (/=) :: IsCandidate -> IsCandidate -> Bool # | |
Read IsCandidate Source # | |
Defined in Distribution.Hup.Types readsPrec :: Int -> ReadS IsCandidate # readList :: ReadS [IsCandidate] # readPrec :: ReadPrec IsCandidate # readListPrec :: ReadPrec [IsCandidate] # | |
Show IsCandidate Source # | |
Defined in Distribution.Hup.Types showsPrec :: Int -> IsCandidate -> ShowS # show :: IsCandidate -> String # showList :: [IsCandidate] -> ShowS # |