haskell-packages-0.4: Haskell suite library for package management and integration with Cabal

Safe HaskellNone
LanguageHaskell2010

Distribution.HaskellSuite.Compiler

Contents

Description

This module is designed to be imported qualified:

import qualified Distribution.HaskellSuite.Compiler as Compiler

Synopsis

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).

Associated Types

type DB compiler Source #

The database type used by the compiler

Methods

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

installLib :: compiler -> FilePath -> FilePath -> Maybe FilePath -> PackageIdentifier -> [ModuleName] -> IO () Source #

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

list :: compiler -> PackageDB -> IO () Source #

type CompileFn Source #

Arguments

 = 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

-> [UnitId]

dependencies

-> [FilePath]

list of files to compile

-> IO () 

Compilation function

Simple compiler

simple Source #

Arguments

:: String

compiler name

-> Version

compiler version

-> [Language] 
-> [Extension] 
-> CompileFn 
-> [String]

extensions that generated file have

-> Simple db 

Command line

Compiler's entry point.

It parses command line options (that are typically passed by Cabal) and invokes the appropriate compiler's methods.

main :: Is c => c -> IO () Source #

customMain :: Is c => Parser (IO ()) -> c -> IO () Source #