Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module is designed to be imported qualified:
import qualified Distribution.HaskellSuite.Compiler as Compiler
- class IsPackageDB (DB compiler) => Is compiler where
- type DB compiler
- name :: compiler -> String
- version :: compiler -> Version
- fileExtensions :: compiler -> [String]
- compile :: compiler -> CompileFn
- languages :: compiler -> [Language]
- languageExtensions :: compiler -> [Extension]
- installLib :: compiler -> FilePath -> FilePath -> Maybe FilePath -> PackageIdentifier -> [ModuleName] -> IO ()
- register :: compiler -> PackageDB -> InstalledPackageInfo -> IO ()
- unregister :: compiler -> PackageDB -> PackageId -> IO ()
- list :: compiler -> PackageDB -> IO ()
- type CompileFn = FilePath -> Maybe Language -> [Extension] -> CpphsOptions -> PackageId -> PackageDBStack -> [InstalledPackageId] -> [FilePath] -> IO ()
- data Simple db
- simple :: String -> Version -> [Language] -> [Extension] -> CompileFn -> [String] -> Simple db
- main :: Is c => c -> IO ()
- customMain :: Is c => Parser (IO ()) -> c -> IO ()
Compiler description
class IsPackageDB (DB compiler) => Is compiler where Source
An abstraction over a Haskell compiler.
Once you've written a Compiler.
Is
instance, you get Cabal
integration for free (via Compiler
.main
).
Consider whether Compiler.
Simple
suits your needs — then you need to
write even less code.
Minimal definition: DB
, name
, version
, fileExtensions
,
compile
, languages
, languageExtensions
.
fileExtensions
are only used for installLib
, so if you define
a custom installLib
, fileExtensions
won't be used (but you'll still
get a compiler warning if you do not define it).
name :: compiler -> String Source
Compiler's name. Should not contain spaces.
version :: compiler -> Version Source
Compiler's version
fileExtensions :: compiler -> [String] Source
File extensions of the files generated by the compiler. Those files will be copied during the install phase.
compile :: compiler -> CompileFn Source
How to compile a set of modules
languages :: compiler -> [Language] Source
Languages supported by this compiler (such as Haskell98
,
Haskell2010
etc.)
languageExtensions :: compiler -> [Extension] Source
Extensions supported by this compiler
:: compiler | |
-> FilePath | build dir |
-> FilePath | target dir |
-> Maybe FilePath | target dir for dynamic libraries |
-> PackageIdentifier | |
-> [ModuleName] | |
-> IO () |
register :: compiler -> PackageDB -> InstalledPackageInfo -> IO () Source
Register the package in the database. If a package with the same id is already installed, it should be replaced by the new one.
unregister :: compiler -> PackageDB -> PackageId -> IO () Source
Unregister the package
IsPackageDB db => Is (Simple db) |
= FilePath | build directory |
-> Maybe Language | optional default language |
-> [Extension] | default extensions |
-> CpphsOptions | CPP options |
-> PackageId | name and version of the package being compiled |
-> PackageDBStack | package db stack to use |
-> [InstalledPackageId] | dependencies |
-> [FilePath] | list of files to compile |
-> IO () |
Compilation function
Simple compiler
Command line
Compiler's entry point.
It parses command line options (that are typically passed by Cabal) and invokes the appropriate compiler's methods.