doctest-parallel-0.4: Test interactive Haskell examples

Safe Haskell | None
Language | Haskell2010

Test.DocTest.Helpers

Synopsis

- rmList :: Ord a => [a] -> [a] -> [a]
- data Library = Library {
  - libSourceDirectories :: [FilePath]
  - libCSourceDirectories :: [FilePath]
  - libModules :: [ModuleName]
  - libDefaultExtensions :: [Extension]
  - libDefaultLanguages :: [Language]
  }
- mergeLibraries :: [Library] -> Library
- libraryToGhciArgs :: Library -> ([String], [String], [String])
- dropEnd :: Int -> [a] -> [a]
- findCabalPackage :: HasCallStack => String -> IO FilePath
- compatPrettyShow :: SymbolicPath PackageDir SourceDir -> FilePath
- solveCondTree :: CondTree ConfVar c a -> [(c, a)]
- buildGhc :: Version
- extractSpecificCabalLibrary :: Maybe String -> FilePath -> IO Library
- extractCabalLibrary :: FilePath -> IO Library

# Documentation

rmList :: Ord a => [a] -> [a] -> [a] Source #

Efficient implementation of set like deletion on lists

    >>> "abcd" `rmList` "ad"
    "bc"
    >>> "aaabcccd" `rmList` "ad"
    "bccc"

data Library Source #

Constructors

Library |

Fields

- libSourceDirectories :: [FilePath]

  Haskell source directories

- libCSourceDirectories :: [FilePath]

  C source directories

- libModules :: [ModuleName]

  Exposed modules

- libDefaultExtensions :: [Extension]

  Extensions enabled by default

- libDefaultLanguages :: [Language]

  Language version(s) to enable

#### Instances

Instances details

Show Library Source # |
Instance details Defined in Test.DocTest.Helpers Methods showsPrec :: Int -> Library -> ShowS Source # show :: Library -> String Source # showList :: [Library] -> ShowS Source #

mergeLibraries :: [Library] -> Library Source #

Merge multiple libraries into one, by concatenating all their fields.

libraryToGhciArgs :: Library -> ([String], [String], [String]) Source #

Convert a Library to arguments suitable to be passed to GHCi.

dropEnd :: Int -> [a] -> [a] Source #

Drop a number of elements from the end of the list.

    dropEnd 3 "hello"  == "he"
    dropEnd 5 "bye"    == ""
    dropEnd (-1) "bye" == "bye"
    \i xs -> dropEnd i xs `isPrefixOf` xs
    \i xs -> length (dropEnd i xs) == max 0 (length xs - max 0 i)
    \i -> take 3 (dropEnd 5 [i..]) == take 3 [i..]

findCabalPackage :: HasCallStack => String -> IO FilePath Source #

Searches for a file called `package.cabal`, where `package` is given as an argument. It will look for it in the current directory. If it can't find it there, it will traverse up until it finds the file or a file called `cabal.project`. In case of the latter, it will traverse down recursively until it encounters a `package.cabal`.

The returned path points to the `package.cabal`. Errors if it could not find `package.cabal` anywhere, or when it found multiple.

compatPrettyShow :: SymbolicPath PackageDir SourceDir -> FilePath Source #

solveCondTree :: CondTree ConfVar c a -> [(c, a)] Source #

Traverse the given tree, solve predicates in branches, and return its contents.

XXX: Branches guarded by Cabal flags are ignored. I'm not sure where we should get this info from.

buildGhc :: Version Source #

GHC version as Cabal's `Version` data structure

extractSpecificCabalLibrary :: Maybe String -> FilePath -> IO Library Source #

Given a filepath to a `package.cabal`, parse it, and yield a Library. Yields the default Library if first argument is Nothing, otherwise it will look for a specific sublibrary.

extractCabalLibrary :: FilePath -> IO Library Source #

Given a filepath to a `package.cabal`, parse it, and yield a Library. Returns and error if no library was specified in the cabal package file.