hets -- a heterogenous Specification (CASL) tool setContentsIndex
Common.Utils
Portability portable
Stability provisional
Maintainer hets@tzi.de
Description

Useful functions that can't be found in the libraries. But should shared across HetCATS.

Todo: - Add your own functions.

Synopsis
joinWith :: a -> [[a]] -> [a]
splitOn :: Eq a => a -> [a] -> [[a]]
basename :: FilePath -> FilePath
dirname :: FilePath -> FilePath
fileparse :: [String] -> FilePath -> (FilePath, FilePath, Maybe String)
stripDir :: FilePath -> (FilePath, FilePath)
rmSuffix :: String -> String
stripSuffix :: [String] -> FilePath -> (FilePath, Maybe String)
stripOf :: (Show a, Eq a) => [a] -> [a] -> [a]
chomp :: String -> String
data IgnoreMaybe a
= RealJust a
| RealNothing
| IgnoreNothing
dropIgnore :: [IgnoreMaybe a] -> [Maybe a]
toIgnore :: Maybe a -> IgnoreMaybe a
toMaybe :: IgnoreMaybe a -> Maybe a
mapIgnore :: (Maybe a -> b) -> [IgnoreMaybe a] -> [b]
mapIgnoreMaybe :: (a -> b) -> [IgnoreMaybe a] -> [b]
setAddOne :: Eq a => [a] -> a -> [a]
setAdd :: Eq a => [a] -> [a] -> [a]
allUnique :: Eq a => [a] -> Bool
notUnique :: Eq a => [a] -> [a]
Documentation
joinWith
:: aseperator element
-> [[a]]list of lists of elements
-> [a]
A function inspired by perls join function. It joins a list of lists of elements by seperating them with a seperator element.
splitOn
:: Eq a
=> aseperator
-> [a]list to split
-> [[a]]
A function inspired by the perl function split. A list is splitted on a seperator element in smaller lists. The seperator element is dropped from the resulting list.
basename :: FilePath -> FilePath
A function inspired by a perl function from the standard perl-module File::Basename. It removes the directory part of a filepath.
dirname :: FilePath -> FilePath
A function inspired by a perl function from the standard perl-module File::Basename. It gives the directory part of a filepath.
fileparse
:: [String]list of suffixes
-> FilePath
-> (FilePath, FilePath, Maybe String)(basename,directory,matched suffix)
A function inspired by a perl function from the standard perl-module File::Basename. It splits a filepath into the basename, the directory and gives the suffix that matched from the list of suffixes. If a suffix matched it is removed from the basename.
stripDir :: FilePath -> (FilePath, FilePath)
rmSuffix :: String -> String
stripSuffix :: [String] -> FilePath -> (FilePath, Maybe String)
stripOf :: (Show a, Eq a) => [a] -> [a] -> [a]
chomp :: String -> String
like the chomp from Perl but this chomp removes trailing newlines AND trailing spaces if any
data IgnoreMaybe a
Constructors
RealJust a
RealNothing
IgnoreNothing
dropIgnore :: [IgnoreMaybe a] -> [Maybe a]
toIgnore :: Maybe a -> IgnoreMaybe a
toMaybe :: IgnoreMaybe a -> Maybe a
mapIgnore :: (Maybe a -> b) -> [IgnoreMaybe a] -> [b]
mapIgnoreMaybe :: (a -> b) -> [IgnoreMaybe a] -> [b]
setAddOne :: Eq a => [a] -> a -> [a]
setAdd :: Eq a => [a] -> [a] -> [a]
allUnique :: Eq a => [a] -> Bool
notUnique :: Eq a => [a] -> [a]
Produced by Haddock version 0.6