Extensions.Cabal

extensions-0.1.0.2: Parse Haskell Language Extensions

Copyright | (c) 2020-2022 Kowainik
License | MPL-2.0
Maintainer | Kowainik <xrom.xkov@gmail.com>
Safe Haskell | None
Language | Haskell2010

Extensions.Cabal

Contents

- Bridge between Cabal and GHC extensions

Description

Functions to extract extensions from the `.cabal` files.

Synopsis

- parseCabalFileExtensions :: FilePath -> IO (Map FilePath ParsedExtensions)
- parseCabalExtensions :: FilePath -> ByteString -> IO (Map FilePath ParsedExtensions)
- extractCabalExtensions :: GenericPackageDescription -> IO (Map FilePath ParsedExtensions)
- cabalToGhcExtension :: Extension -> Maybe (Either SafeHaskellExtension OnOffExtension)
- toGhcExtension :: KnownExtension -> Maybe Extension
- toSafeExtensions :: KnownExtension -> Maybe SafeHaskellExtension

# Documentation

parseCabalFileExtensions :: FilePath -> IO (Map FilePath ParsedExtensions) #

Parse default extensions from a `.cabal` file under given `FilePath`.

Throws:

- `CabalException`

parseCabalExtensions :: FilePath -> ByteString -> IO (Map FilePath ParsedExtensions) #

Parse default extensions from a `.cabal` file content. This function takes a path to a `.cabal` file. The path is only used for error message. Pass empty string, if you don't have a path to `.cabal` file.

Throws:

- `CabalException`

extractCabalExtensions :: GenericPackageDescription -> IO (Map FilePath ParsedExtensions) #

Extract Haskell Language extensions from a Cabal package description.

# Bridge between Cabal and GHC extensions

cabalToGhcExtension :: Extension -> Maybe (Either SafeHaskellExtension OnOffExtension) #

Convert `Extension` to `OnOffExtension` or `SafeHaskellExtension`.

toGhcExtension :: KnownExtension -> Maybe Extension #

Convert `KnownExtension` to `OnOffExtension`.

toSafeExtensions :: KnownExtension -> Maybe SafeHaskellExtension #

Convert `KnownExtension` to `SafeHaskellExtension`.