Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start the manual and architecture document #10

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 3 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,8 @@ The tool can be used with the following GHC versions:

Pick the one that matches your operating system *and* GHC version.

## Usage
## 🤸 Documentation

Go in your project and build it with the GHC environment files enabled:
Read the [Manual](./doc/MANUAL.md) to learn how to use this tool

```
$ cabal build --write-ghc-environment-files=always
```

Then run the `print-api` binary from within the same directory:

```
$ print-api -p <my-package>
```

For instance in the [`text-display`](https://github.com/haskell-text/text-display) repository:

```haskell
❯ print-api -p text-display

module 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
```
Additional details can be found in the [Architecture document](./doc/ARCHITECTURE.md)
7 changes: 7 additions & 0 deletions doc/ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Architecture

## The GHC API

### Compatibility over several versions

### The package database
52 changes: 52 additions & 0 deletions doc/MANUAL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## NAME

print-api – Export the public API of your Haskell package

## SYNOPSIS

<dl>
<dt>print-api <i>(-p|--package-name PACKAGE NAME)</i></dt>
<dd style="margin-left: 1rem;">Export the API of a package</dd>
</dl>

## DESCRIPTION

*print-api* exports the API exposed by a Haskell package. This is used to maintain a file that can be tracked by version control and used in Golden Tests.

## OPTIONS

### -p|--package-name PACKAGE NAME

_Mandatory_

Specify for which package you wish to have the API export.

## Usage

Go in your project and build it with the GHC environment files enabled:

```
$ cabal build --write-ghc-environment-files=always
```

Then run the `print-api` binary from within the same directory:

```
$ print-api -p <my-package>
```

For instance in the [`text-display`](https://github.com/haskell-text/text-display) repository:

```haskell
❯ print-api -p text-display

module 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
```
Loading