hup-0.3.0.3: Upload packages and/or documentation to a hackage server

Safe HaskellSafe
LanguageHaskell2010

Distribution.Hup.Parse

Description

extract info from cabal files and .tgz names.

Synopsis

Documentation

rstrip :: String -> String Source #

strip whitespace from end

>>> rstrip "abcd \t\n\r"
"abcd"

lstrip :: String -> String Source #

strip whitespace from beginning

>>> lstrip "\t\n\r   abcd"
"abcd"

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"})