# Haskell (/pipeline-sdk/reference/toolchains/haskell)



{/* Generated by docs-site/scripts/generate-dsl-docs.ts — do not edit. */}

## `haskell` [#haskell]

Callable singleton for the Haskell toolchain — access as `hm.haskell`.

Supports both object form (`hm.haskell(ghc="9.6.7")`) and bare form
(`hm.haskell.build(ghc="9.6.7", path="api")`, etc.).

```python
haskell(*, ghc=None, cabal='latest', image=None, base=None, path=None, cache_paths=None) -> HaskellToolchain | HaskellPackage
```

| Parameter                                              | Type                      | Default    | Description                                              |
| ------------------------------------------------------ | ------------------------- | ---------- | -------------------------------------------------------- |
| `ghc`                                                  | `str \| None`             | `None`     | GHC version to install (e.g. `"9.6.7"`). Required.       |
| `cabal`                                                | `str`                     | `'latest'` | cabal-install version. Defaults to `"latest"`.           |
| `image`                                                | `str \| None`             | `None`     | Local-mode Docker base image override.                   |
| `base`                                                 | `Step \| None`            | `None`     | Existing `Step` to attach to instead of emitting a fresh |
| apt-base step.                                         |                           |            |                                                          |
| `path`                                                 | `str \| None`             | `None`     | Cabal package root. When provided, the call returns a    |
| `HaskellPackage` directly rather than a toolchain.     |                           |            |                                                          |
| `cache_paths`                                          | `tuple[str, ...] \| None` | `None`     | Override the cabal-file paths for deps-step cache        |
| invalidation. Only meaningful when `path` is also set. |                           |            |                                                          |

**Returns** `HaskellToolchain | HaskellPackage` — A `HaskellToolchain` when `path` is omitted, or a

### `haskell.build()` [#haskellbuild]

```python
build(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `haskell.fmt()` [#haskellfmt]

```python
fmt(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `haskell.hlint()` [#haskellhlint]

```python
hlint(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `haskell.lint()` [#haskelllint]

```python
lint(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `haskell.test()` [#haskelltest]

```python
test(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

## `HaskellEntry` [#haskellentry]

Callable singleton for the Haskell toolchain — access as `hm.haskell`.

Supports both object form (`hm.haskell(ghc="9.6.7")`) and bare form
(`hm.haskell.build(ghc="9.6.7", path="api")`, etc.).

### `HaskellEntry.build()` [#haskellentrybuild]

```python
build(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `HaskellEntry.fmt()` [#haskellentryfmt]

```python
fmt(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `HaskellEntry.hlint()` [#haskellentryhlint]

```python
hlint(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `HaskellEntry.lint()` [#haskellentrylint]

```python
lint(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `HaskellEntry.test()` [#haskellentrytest]

```python
test(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

## `HaskellPackage` [#haskellpackage]

One cabal package — returned by `HaskellToolchain.package()`.

`installed` is the package's `deps` step (the chain ancestor every
action leaf attaches to). Exposed so callers can chain custom commands
onto the deps-installed snapshot via `pkg.installed.sh(...)`.

### Fields [#fields]

| Field       | Type   | Default    |
| ----------- | ------ | ---------- |
| `path`      | `str`  | *required* |
| `installed` | `Step` | *required* |

### `HaskellPackage.build()` [#haskellpackagebuild]

```python
build(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `HaskellPackage.fmt()` [#haskellpackagefmt]

```python
fmt(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `HaskellPackage.hlint()` [#haskellpackagehlint]

```python
hlint(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `HaskellPackage.lint()` [#haskellpackagelint]

```python
lint(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `HaskellPackage.test()` [#haskellpackagetest]

```python
test(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

## `HaskellToolchain` [#haskelltoolchain]

Haskell toolchain install chain — constructed via `hm.haskell()`.

Holds the shared `ghcup` install step. Spawn one `HaskellPackage`
per cabal package via `.package(path)`. All packages from one
toolchain share the same ghcup-install step.

### Fields [#fields-1]

| Field           | Type   | Default    |
| --------------- | ------ | ---------- |
| `ghc`           | `str`  | *required* |
| `cabal_version` | `str`  | *required* |
| `installed`     | `Step` | *required* |

### `HaskellToolchain.cabal()` [#haskelltoolchaincabal]

```python
cabal(path, *, cache_paths=None) -> HaskellPackage
```

Create a `HaskellPackage` for the cabal package at `path`.

Alias for `.package()`; reads more naturally for cabal projects.

| Parameter     | Type                      | Default    | Description                                            |
| ------------- | ------------------------- | ---------- | ------------------------------------------------------ |
| `path`        | `str`                     | *required* | Path to the cabal package root.                        |
| `cache_paths` | `tuple[str, ...] \| None` | `None`     | Override the set of paths used for cache invalidation. |

**Returns** `HaskellPackage` — A `HaskellPackage` ready for action methods.

### `HaskellToolchain.package()` [#haskelltoolchainpackage]

```python
package(path, *, cache_paths=None) -> HaskellPackage
```

Create a `HaskellPackage` for the cabal package at `path`.

Emits a `cabal build all --only-dependencies` step cached on the
package's cabal files. Action methods on the returned package attach
to that deps step.

| Parameter                                                       | Type                      | Default    | Description                                              |
| --------------------------------------------------------------- | ------------------------- | ---------- | -------------------------------------------------------- |
| `path`                                                          | `str`                     | *required* | Path to the cabal package root. Must contain a `*.cabal` |
| file and optionally a `cabal.project`.                          |                           |            |                                                          |
| `cache_paths`                                                   | `tuple[str, ...] \| None` | `None`     | Override the set of paths used for cache invalidation.   |
| Defaults to `(f"\{path\}/*.cabal", f"\{path\}/cabal.project")`. |                           |            |                                                          |

**Returns** `HaskellPackage` — A `HaskellPackage` ready for action methods.

**Examples**

```python
>>> import harmont as hm
>>> tc = hm.haskell(ghc="9.6.7")
>>> pkg = tc.package("api")
>>> hm.pipeline(pkg.build(), pkg.test())
```
