Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kleidukos/print-api
Dump the declarations of Haskell modules
https://github.com/kleidukos/print-api
Last synced: 2 months ago
JSON representation
Dump the declarations of Haskell modules
- Host: GitHub
- URL: https://github.com/kleidukos/print-api
- Owner: Kleidukos
- Created: 2024-07-18T17:28:53.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-09-15T21:22:10.000Z (4 months ago)
- Last Synced: 2024-10-25T13:50:27.823Z (3 months ago)
- Language: Haskell
- Size: 75.2 KB
- Stars: 11
- Watchers: 3
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# print-api
_(If you want to use this tool as a GitHub Workflow, check out [diff-package-api](https://github.com/Kleidukos/diff-package-api/))_
Taken from the GHC CI scripts, this tool prints a human-readable representation of the exposed interface of Haskell modules that you
can use in CI to ensure that you do not mistakenly introduce a regression.## Installation
Binaries for the following operating systems and GHC are provided:
| GHC / OS | Ubuntu 22.04 (glibc) | Alpine 3.20 (musl) | macOS 14 |
|---|---|---|---|
| 9.10.1 | ✅ | ✅ | ✅ |
| 9.8.2 | ✅ | ✅ | ✅ |
| 9.6.6 | ✅ | ✅ | ✅ |### Releases
* [Pre-releases](https://github.com/Kleidukos/print-api/releases/tag/print-api-head) are provided if you need an urgent fix for a bug;
* [Official releases](https://github.com/Kleidukos/print-api/releases/latest) are available if you need stability and you don't urgently require the latest features.If you have the [GitHub CLI](https://cli.github.com/) installed, (something like) the following does work:
```
$ gh release download --repo Kleidukos/print-api --pattern "print-api-*-$(uname -s)-$(uname -m).tar.gz" --output - | tar -x -z -C
```## Usage
Go in your project and build it with the GHC environment files enabled:
```
$ cabal build --write-ghc-environment-files=always
```You need the appropriate `print-api-` in your `PATH`. That means,
if you did not obtain the executables from the GitHub Releases as described
above but build and installed `print-api` yourself, then you need to install it
for the GHC version you intend to use; For example:```
$ git clone https://github.com/Kleidukos/print-api.git
$ cd print-api
$ cabal install --with-compiler ghc-
```There is also an `install-for-ghcup-compilers.sh` script in the `print-api` repository that installs `print-api` for GHCs currently installed by GHCup.
Then run the `print-api` binary from within the source tree of your project:
```
$ print-api -p
```### Ignore list of modules
By passing the `--modules-ignore-list FILE` option to `print-api`, you can specify
a list of newline-delimited module names that will be ignored by `print-api`,
and shown as having been ignored in the output.### Example
For instance in the [`text-display`](https://github.com/haskell-text/text-display) repository:
```haskell
❯ print-api -p text-displaymodule Data.Text.Display where
type Display :: * -> Constraint
class Display a where
displayBuilder :: a -> Data.Text.Internal.Builder.Builder
displayList :: [a] -> Data.Text.Internal.Builder.Builder
displayPrec :: GHC.Types.Int -> a -> Data.Text.Internal.Builder.Builder
{-# MINIMAL displayBuilder | displayPrec #-}
{-# MINIMAL displayBuilder | displayPrec #-}
type role OpaqueInstance phantom representational
```