Safe Haskell | None |
---|
- class LogicTree a where
- lt :: [Int] -> ConstrTree
- gt :: [Int] -> ConstrTree
- eq :: [Int] -> ConstrTree
- ltEq :: [Int] -> ConstrTree
- gtEq :: [Int] -> ConstrTree
- closedOpen :: String -> [Int] -> [Int] -> Package
- apiVersion :: String -> [Int] -> Package
- nextBreaking :: String -> [Int] -> Package
- nextMajor :: String -> [Int] -> Package
- exactly :: String -> [Int] -> Package
- class Field a where
- conditional :: CondBlock a -> a
- buildInfo :: BuildInfoField -> a
- cif :: Field a => CondTree -> [a] -> [a] -> a
- system :: String -> CondTree
- arch :: String -> CondTree
- impl :: Compiler -> Maybe ConstrTree -> CondTree
- flag :: String -> CondTree
- true :: CondTree
- false :: CondTree
- buildDepends :: Field a => [Package] -> a
- otherModules :: Field a => [String] -> a
- hsSourceDirs :: Field a => [String] -> a
- extensions :: Field a => [String] -> a
- buildTools :: Field a => [Package] -> a
- buildable :: Field a => Bool -> a
- ghcOptions :: Field a => [String] -> a
- ghcProfOptions :: Field a => [String] -> a
- ghcSharedOptions :: Field a => [String] -> a
- hugsOptions :: Field a => [String] -> a
- nhc98Options :: Field a => [String] -> a
- includes :: Field a => [String] -> a
- installIncludes :: Field a => [String] -> a
- includeDirs :: Field a => [String] -> a
- cSources :: Field a => [String] -> a
- extraLibraries :: Field a => [String] -> a
- extraLibDirs :: Field a => [String] -> a
- ccOptions :: Field a => [String] -> a
- cppOptions :: Field a => [String] -> a
- ldOptions :: Field a => [String] -> a
- pkgConfigDepends :: Field a => [Package] -> a
- frameworks :: Field a => [String] -> a
- defaultLanguage :: Field a => Language -> a
- render :: String -> Cabal -> IO ()
- renderString :: String -> ZonedTime -> Version -> Cabal -> String
- modules :: FilePath -> IO [String]
- fileExtensions :: [String]
- modulesWithExtensions :: [String] -> FilePath -> IO [String]
Logic trees
Building constraints
Helpers to build many common version constraints.
Building constraint trees
lt :: [Int] -> ConstrTreeSource
gt :: [Int] -> ConstrTreeSource
eq :: [Int] -> ConstrTreeSource
ltEq :: [Int] -> ConstrTreeSource
gtEq :: [Int] -> ConstrTreeSource
Building package specifications
:: String | Package name |
-> [Int] | Version number for lower bound |
-> [Int] | Version number for upper bound |
-> Package | Resulting contraints |
Creates a package interval that is closed on the left, open on the right. Useful for the common case under the PVP to specify that you depend on a version that is at least a particular version, but less than another version.
closedOpen "bytestring" [0,17] [0,19] ==> bytestring >= 0.17 && < 0.19
apiVersion :: String -> [Int] -> PackageSource
Specifies a particular API version. Useful to lock your package dependencies down to a particular API version.
apiVersion "base" [1] ==> base >= 1 && < 2 apiVersion "base" [1,2] ==> base >= 1.2 && < 1.3 apiVersion "base" [1,2,3] ==> base >= 1.2.3 && < 1.2.4
nextBreaking :: String -> [Int] -> PackageSource
Depends on the version given, up to the next breaking API change.
nextBreaking "base" [4] ==> base >= 4 && < 4.1 nextBreaking "base" [4,1] ==> base >= 4.1 && < 4.2 nextBreaking "base" [4,7,0,0] ==> base >= 4.7.0.0 && < 4.8
nextMajor :: String -> [Int] -> PackageSource
Depends on the version given, up to the next time the first
digit increments. Useful for base
.
nextBreaking "base" [4] ==> base >= 4 && < 5
exactly :: String -> [Int] -> PackageSource
Depends on exactly this version only.
exactly "base" [4,5,0,0] ==> base ==4.5.0.0
Field class
Things that can be an item in a field in a Cabal file.
conditional :: CondBlock a -> aSource
Takes a conditional block and wraps it in the field type.
buildInfo :: BuildInfoField -> aSource
Takes a build information field and wraps it in the field type.
Conditionals
:: Field a | |
=> CondTree | Condition to satisfy |
-> [a] | Use these results if condition is true |
-> [a] | Use these results if condition if false |
-> a |
Builds if
statements. Use with the following functions, such
as flag
, to make it easy to build conditional blocks. For
example:
cif (flag "buildExe") [buildable True] [buildable False]
A little more complicated:
cif (flag "buildExe" &&& system "windows") [buildable True] [buildable False]
system :: String -> CondTreeSource
Operating system; tested against System.Info.os
on the
target system.
impl :: Compiler -> Maybe ConstrTree -> CondTreeSource
Tests for the configured Haskell implementation.
flag :: String -> CondTreeSource
Evaluates to the current assignment of the flag of the given name. Flag names are case insensitive. Testing for flags that have not been introduced with a flag section is an error.
Build info builders
buildDepends :: Field a => [Package] -> aSource
otherModules :: Field a => [String] -> aSource
hsSourceDirs :: Field a => [String] -> aSource
extensions :: Field a => [String] -> aSource
buildTools :: Field a => [Package] -> aSource
ghcOptions :: Field a => [String] -> aSource
ghcProfOptions :: Field a => [String] -> aSource
ghcSharedOptions :: Field a => [String] -> aSource
hugsOptions :: Field a => [String] -> aSource
nhc98Options :: Field a => [String] -> aSource
installIncludes :: Field a => [String] -> aSource
includeDirs :: Field a => [String] -> aSource
extraLibraries :: Field a => [String] -> aSource
extraLibDirs :: Field a => [String] -> aSource
cppOptions :: Field a => [String] -> aSource
pkgConfigDepends :: Field a => [Package] -> aSource
frameworks :: Field a => [String] -> aSource
defaultLanguage :: Field a => Language -> aSource
Rendering a cabal file
:: String | The name of the program used to produce this output. Put the name of your script here so it can appear in the output. This is optional; to omit it, use the empty string here. |
-> Cabal | |
-> IO () |
Render a Cabal file to standard output. The output will have comments at the beginning indicating that it was built with Cartel, and what version of the Cartel library was used, and when the output was produced, along with (optionally) the filename of the program used to produce the output.
Ensures that the output is UTF-8, as required by Cabal.
:: String | Name of program used |
-> ZonedTime | When this output is being created |
-> Version | Cartel package version |
-> Cabal | |
-> String |
Renders a Cabal
data type as a string.
Getting a list of all modules in a directory tree
:: FilePath | Start searching within this directory. |
-> IO [String] | A list of Haskell modules in the given directory tree. The file contents are not examined; only the file names matter. Returned as a list of dotted names. |
Gets all Haskell modules in a given directory tree. Only files
with one of the extensions listed in fileExtensions
are
returned. Files and directories that do not begin with an
uppercase letter are ignored. (This also ignores files that
start with a dot.) Directories with a dot anywhere in the name
are ignored.
fileExtensions :: [String]Source
Common extensions of Haskell files and files that are preprocessed into Haskell files. Includes:
- hs (Haskell)
- lhs (literate Haskell)
- gc (greencard)
- chs (c2hs)
- hsc (hsc2hs)
- y and ly (happy)
- x (alex)
- cpphs
:: [String] | Look for files that have one of these extensions.
|
-> FilePath | Start searching within this directory. |
-> IO [String] | A list of Haskell modules in the given directory tree. The file contents are not examined; only the file names matter. Returned as a list of dotted names. |
Gets all Haskell modules in a given directory tree. Allows you to specify what extensions you are interested in.