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

Safe HaskellNone

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 whereSource

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 -> StringSource

Compiler's name. Should not contain spaces.

version :: compiler -> VersionSource

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 -> CompileFnSource

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

installLibSource

Arguments

:: 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

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

Instances

IsPackageDB db => Is (Simple db) 

type CompileFnSource

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

-> [InstalledPackageId]

dependencies

-> [FilePath]

list of files to compile

-> IO () 

Compilation function

Simple compiler

data Simple db Source

Instances

IsPackageDB db => Is (Simple db) 

simpleSource

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